Encode and decode Base64.

Paste text or Base64 and convert between the two instantly, entirely in your browser.

  • Liveconverts as you type
  • 1 MBlargest file it encodes
  • UTF-8so accents and emoji survive
Base64 encoderRuns in your browser

Loading the tool…

How it works

From text to Base64 and back in three steps.

  1. Type or paste

    Type or paste text, or Base64 to decode. The result updates with every change.

  2. Pick a direction

    Text to Base64 encodes and Base64 to text decodes. Switch after a conversion and the result moves into the box.

  3. Copy the result

    Copy output puts the result on your clipboard. File mode does the same for a file up to 1 MB.

In the encoder

What the Base64 encoder does.

  • Encodes as you type

    The Base64 appears with every change, with no button to press.

  • Decodes back to text

    Paste Base64 and read the text it holds.

  • UTF-8 throughout

    Accented letters and emoji encode and decode without errors.

  • Wrapped input

    Line breaks and spaces in pasted Base64 are ignored.

  • Optional padding

    Base64 without its = padding at the end still decodes.

  • Named errors

    Characters outside the alphabet, a wrong length and binary data are each named.

  • Encodes a file

    Choose a file up to 1 MB and get its Base64 string.

  • Sizes shown

    A file's size and the number of Base64 characters it became.

  • Swaps direction

    The last result moves into the box when you switch.

  • Copy output

    One click puts the result on your clipboard.

  • Character count

    The input's length updates as you type.

  • Stays in the page

    Nothing you paste or choose is sent anywhere.

What you see

Text and its Base64, side by side.

The text you type and the Base64 it becomes. Here the text holds an accented letter and an emoji, and both come back unchanged when the Base64 is decoded.

  • Converts as you type
  • Accents and emoji kept intact
  • Copy output in one click

Base64

Why encode Base64 here.

Base64 turns up in data URIs, email attachments and config files, and it cannot be read by eye. The tool above converts in both directions as you type, turning text into UTF-8 bytes first so accented letters and emoji come back intact. The URL-safe variant uses - and _, as a JWT does, so a token belongs in a decoder built for JSON web tokens.

File mode prints plain Base64, so add a prefix such as data:image/png;base64, before pasting it into CSS or HTML. A page with its images inlined this way is a single file, and you can put that one HTML file online with every image inside it.

Base64 headed for a query string needs the URL encoder's component mode as well, because +, / and = mean something in a URL. The tool is free with no account, and uploading a file to get a shareable link is free too.

Frequently asked questions

  • Does the data leave my browser?

    No. Encoding and decoding happen in this page, and nothing you paste or choose is sent anywhere.

  • Can it handle files, not just text?

    Yes, for encoding, up to 1 MB. The tool shows the file's size and the Base64, ready to copy. Decoding works on text only, so it cannot rebuild a file.

  • Why won't my Base64 decode to text?

    The tool names the problem. The input may use characters outside the standard alphabet, such as the - and _ of URL-safe Base64, or be the wrong length, which usually means part of it was lost in copying. Valid Base64 that holds binary data, such as an image, is reported by its byte count.

  • Is the Base64 encoder free?

    Yes. Encoding, decoding and file mode need no account and cost nothing, and there is no limit on how often you use them.

  • Does it handle emoji and accented letters?

    Yes. Text is turned into UTF-8 bytes before it is encoded, and decoding reads UTF-8 back, so é, ß and emoji come out exactly as they went in. The browser's own btoa function throws an error on characters like these when it is used alone, which is why the tool converts to bytes first.

  • Does it need the = padding at the end?

    No. Base64 without its closing = signs decodes as long as the length is otherwise valid. An = in the middle of the text, or more than two at the end, counts as a character outside the alphabet.

  • What about line breaks in pasted Base64?

    Spaces and line breaks are removed before decoding, so Base64 copied out of an email, a key file or a wrapped log line decodes as one string.

  • What happens when I switch direction?

    When the box holds a result, switching between Text to Base64 and Base64 to text moves that result into the box. Encode some text, switch, and the Base64 is already waiting to be decoded. If the box is empty or shows an error, your input stays as it is.

  • How do I use the output as a data URI?

    Put a prefix in front of it that names the file type, such as data:image/png;base64, for a PNG, then paste the whole string where a URL goes in CSS or an img tag. The tool prints the Base64 alone, so the prefix is yours to add.

  • Why is the Base64 longer than the original?

    Base64 writes every 3 bytes as 4 characters, so the output is about a third longer than the input, plus up to two = signs of padding. File mode shows the file's size and the number of Base64 characters it became.

  • Is Base64 a form of encryption?

    No. Base64 writes bytes as plain characters, and anyone can decode it. Use it to carry data through places that only accept text, not to hide it.

  • Does the encoder keep my text?

    No. The text lives in this page while it is open. Nothing is saved in the browser or sent anywhere, so reloading the page starts with an empty box.

  • Which file types can file mode encode?

    Any type. The file is read as raw bytes, so an image, a font, a PDF or a ZIP encodes the same way, as long as it is 1 MB or smaller.

  • Does it write URL-safe Base64?

    No. It writes the standard alphabet, with + and / and = padding. For a value going into a URL, run the result through the URL encoder, or swap + for -, / for _ and drop the padding yourself.

  • Does it add line breaks to long output?

    No. The Base64 comes out as one unbroken line, which is what data URIs and most config values expect. The output box wraps it on screen only, and Copy output copies it without breaks.

  • Can it encode text in another character set, such as Latin-1?

    No. Text is always encoded as UTF-8, and decoding reads UTF-8 too. Base64 made from Latin-1 text with accents is reported as binary data rather than text.

  • How much text can I paste?

    There is no set limit. Very long input takes longer to convert, since the result is worked out again on every change.

  • Why does the output end with = signs?

    Base64 works in groups of 3 bytes. When the input does not fill the last group, one or two = signs pad the output to a multiple of 4 characters.

  • Can I paste Base64 that starts with data:?

    Not as it is. Remove everything up to and including the comma first, since the colon, the semicolon and the comma are outside the Base64 alphabet and the decoder reports them.

Get file-sharing tips that actually help.

One email a month. No spam, no fluff.

Ready to try the dev tools?

Free forever, no credit card needed. The whole thing takes a few seconds.

Get started free