TodayTools

Base64 encode and decode

Embed an icon in a page or pass a file through an API in one piece.

PrivateNo uploadsRuns in your browser

Donate
Mode

Guy Man

For sending files

Pack a picture into plain text.

Small task. Ali needs a logo inside his email page.

BeforeFiles that will not paste

With sdevText that travels anywhere

  • Woman Working

    Done in a tap

    The picture turns into text he can paste.

  • A family playing a game on the floor

    On to the weekend

    Work done, time for friends.

How to encode and decode base64

  1. Pick a mode

    Encode turns text into base64, Decode turns base64 back into text, and File encodes any file you drop in. Paste into the left pane, press Open to load a text file, or press Sample to see an example.

  2. Set the options

    Tick Safe for web links to use - and _ with no = padding, the form used in JWTs and query strings. In File mode, tick Data URI to get a data: string ready for an img src or a CSS url().

  3. Copy or download

    The result appears on the right as you type. Press Copy, or Ctrl+C (Cmd+C on Mac) with nothing selected, to copy all of it. In Decode mode, As file saves the decoded bytes when the payload is not text.

Good to know

  • Decode accepts the standard and URL-safe alphabets, with or without padding, and ignores spaces and line breaks. Base64 wrapped at 76 columns in an email works as it is.
  • Text is encoded as UTF-8, so Tamil, emoji and other non-Latin text round-trips correctly. If a decoded payload is not UTF-8 text, a note under the result tells you.
  • Files up to 50 MB can be encoded. Base64 is about a third larger than the original, so a 30 MB file gives roughly 40 MB of text.
  • Only the first 1 MB of a large result is shown on screen. Copy and the size shown in the status line use the full result.
  • Paste base64 while in Encode mode and the tool notices and offers to switch to Decode.
  • Nothing is uploaded. Encoding, decoding and file reading all happen in your browser, so it works offline too.

Where people use it

  • Read a value in a log

    Paste a base64 string from a log or a config and see the plain text behind it.

  • Put an image inside a web page

    Turn a small icon into a data URI and paste it straight into HTML or CSS.

  • Get a file back

    An API sends a PDF or picture as base64. Decode it and download the real file.

  • Safe for web links

    Use the URL-safe style when the value goes into a link or a token.

  • Looking inside a login token?

    Tokens are base64 with extra parts. Read them in full on the JWT page.

    JWT decoder online

Why this one

It turns base64 back into a real file you can download, not just text, and your files never leave your device.

  • Works with text and with files.
  • Decoded files can be downloaded right away.
  • Runs in your browser, nothing is sent.
  • No sign-up, works on phones.

What you can change

  • Encode or decode
  • Text or file
  • URL-safe style
  • Ready-to-paste data URI

People find this page by searching

  • base64 decode
  • base64 encode
  • base64 decoder online
  • base64 to text
  • image to base64
  • base64 to file
  • base64 to pdf
  • url safe base64
  • file to base64 online
Cite this tool
  • APA
    sdev.in. (n.d.). Base64 encode and decode online [Web tool]. https://www.sdev.in/tools/base64
  • MLA
    "Base64 encode and decode online." sdev.in, https://www.sdev.in/tools/base64.
  • Chicago
    sdev.in. "Base64 encode and decode online." https://www.sdev.in/tools/base64.
  • BibTeX
    @misc{sdev-base64,
      title = {Base64 encode and decode online},
      author = {{sdev.in}},
      howpublished = {\url{https://www.sdev.in/tools/base64}},
      note = {Web tool}
    }

Questions people ask

What is base64 used for?

It writes binary data with 64 printable characters so it can travel through text-only channels such as JSON, email and HTML. It is an encoding, not encryption: anyone can decode it, so it hides nothing.

What does URL-safe mean?

Standard base64 uses + and /, which have their own meaning in URLs. The URL-safe variant swaps them for - and _ and drops the trailing = padding. JWTs and many APIs use this form.

Why does the decoded text show odd characters?

The bytes are not UTF-8 text, for example an image, a PDF or a compressed file. Use As file to download the decoded bytes instead of reading them as text.

How do I make a data URI?

Switch to File mode, pick the file and tick Data URI. The result starts with data:<type>;base64, and can go straight into an img src, a CSS url() or a download link.

Is my text or file uploaded?

No. Encoding, decoding and file reading all run in your browser. Nothing is sent to a server.

Donate