Skip to content

Base64 Encoder and Decoder

Turn text into Base64 and back, with accents, ñ and emoji properly encoded in UTF-8. You can also turn a file or image into Base64 or a data URI to paste into HTML, CSS or JSON, and turn Base64 back into a file. Everything happens in your browser: nothing is uploaded.

Works anywhere in the world, wherever you are.

What to do
Variant
Lines

Base64 characters

Waiting for data

Type some text and its Base64 shows up instantly.

Base64

The result shows up here as you type.

Base64 does not encrypt or protect anything: anyone can decode it. It is for moving binary data through places that only take text.

Your data never leaves your device: text and files are encoded and decoded in your browser, are not uploaded, are not in the Share link, are not saved and are not sent to analytics (nor is the file name). Close or reload the page and they are gone.

About this calculator

How to use it

Choose "Text → Base64" and type: the Base64 shows up underneath instantly. With "Base64 → text or file", paste some Base64 and see the text it carries; if it is not text but a file (an image, a PDF), the tool tells you what it looks like and lets you download it, and shows it if it is an image.

With "File → Base64", choose a file from your device, up to 10 MB. You can get it as plain Base64 or as a data URI (data:image/png;base64,…), ready for an <img> or a stylesheet.

"Copy result" puts it on your clipboard and "Download .txt" saves it. Below you see how many bytes went in, how many characters came out and how much it grew.

Example

The text “Hello, Puerto Rico!” takes 19 bytes and in Base64 becomes “SGVsbG8sIFB1ZXJ0byBSaWNvIQ==”, 28 characters long. Every 3 bytes are written as 4 characters, so Base64 is always about 33% longer, and the end is padded with = to complete a group of 4.

A lone “ñ” is “w7E=” and the 😀 emoji is “8J+YgA==”. In the URL-safe variant the same emoji becomes “8J-YgA”: + turns into -, / turns into _ and there is no trailing =.

Why UTF-8 matters

Base64 encodes bytes, not letters. To encode text it first has to become bytes, and the standard way on the web is UTF-8, where “ñ” is 2 bytes and an emoji is 4. JavaScript's btoa function, which many tools use, only takes characters up to code 255: an emoji makes it throw an error, and “ñ” is encoded as a single byte (Latin-1, “8Q==”) instead of UTF-8's 2, so other programs read it differently. This tool turns the text into UTF-8 first, so the Base64 it gives is the same Python, Java or the base64 command on Linux and Mac would give.

Decoding works the other way: the bytes are read as UTF-8. If they do not form valid UTF-8 text, they are treated as a binary file you can download.

Standard or URL-safe

The standard variant (RFC 4648, section 4) uses A–Z, a–z, 0–9, + and /, and pads with =. + and / mean something in web addresses and file names, so the URL-safe variant (section 5) swaps them for - and _, and usually drops the =. It is what JWT tokens and many URLs use.

When decoding you do not have to choose: the tool takes both, with or without trailing =, with line breaks (like email's, which wraps every 76 characters) and with a data: prefix if there is one. If something is not Base64, it tells you which character and on which line and column.

Your data stays with you

Text and files are encoded and decoded entirely in your browser. Nothing is uploaded to any server, nothing is in the "Share" link, nothing is saved on your device and nothing is recorded in the site's statistics, not even the file name. Reload or close the page and it is gone.

Important limitations

  • Base64 is not encryption: anyone can decode it. Do not use it to protect passwords or private data.
  • Files are capped at 10 MB: their Base64 would be over 13 MB of text, too much to handle smoothly on a phone. For a very long result, the page shows the first 100,000 characters; copy and download carry the full result.
  • The type of a decoded file is recognized by its first bytes for common formats (PNG, JPEG, GIF, WebP, PDF, ZIP, GZIP, MP3, MP4, WOFF2 and ICO). If it is not recognized, it downloads as .bin and you can rename the extension.
  • A preview is only shown for PNG, JPEG, GIF and WebP images recognized by their content.

Frequently asked questions

No. Everything happens in your browser: the file is read on your device, is not uploaded, is not in the Share link, is not saved and is not sent to analytics, not even its name.

Because many use JavaScript's btoa function, which throws an error on emoji and encodes accents and ñ as Latin-1 instead of UTF-8. This tool turns the text into UTF-8 before encoding it: “ñ” becomes “w7E=” and 😀 becomes “8J+YgA==”.

About 33%: every 3 bytes are written as 4 characters. A 3 KB file gives about 4 KB of Base64, a little more because of the padding at the end.

A way to put a whole file inside an address: data:, the file type, ;base64, and the Base64. For example, data:image/png;base64,… can be used as an image's src without a separate file.

No. Base64 only changes how the data is written; anyone gets it back in a second. Protecting data takes real encryption.

This calculation runs in your browser and is never sent to a server. Your last values may be saved on your device only, for convenience. Results are estimates and are not financial, tax, accounting or legal advice.