Base64 Encoder & Decoder

Encode text or any file to Base64, or decode Base64 back to text, an image or a downloadable file. Emoji, accents and URL-safe Base64 all work.

Runs entirely in your browser. Nothing you type or upload is sent to a server.

How Base64 works

Computers store everything as bytes, and a byte can hold 256 different values. Many older systems, email above all, were built to carry only a narrow range of plain text characters and would mangle anything else. Base64 solves this by rewriting bytes using just 64 characters that survive everywhere.

It takes the input three bytes (24 bits) at a time and splits those bits into four groups of six. Six bits can hold 64 values, and each value maps to one character of the alphabet A–Z a–z 0–9 + /. The word "Man" is the classic example:

Text      M        a        n
Bytes     01001101 01100001 01101110
6-bit     010011 010110 000101 101110
Values    19     22     5      46
Base64    T      W      F      u        →  TWFu

When the input is not a multiple of three bytes, the output is padded with one or two = signs so its length stays a multiple of four. Because three bytes become four characters, Base64 is always about a third larger than the original.

Where you will meet it

  • Email attachments. Every photo or PDF you email travels as Base64 inside the message, wrapped at 76 characters per line.
  • Data URIs. data:image/png;base64,... embeds a file directly in HTML or CSS, saving a request for a tiny icon.
  • APIs and JSON. JSON has no binary type, so files and signatures are sent as Base64 strings.
  • Web tokens. A JSON Web Token is three URL-safe Base64 sections separated by dots. The JWT Decoder reads them.
  • HTTP Basic authentication. The header Authorization: Basic dXNlcjpwYXNz is just user:pass in Base64, which is why Basic auth is only safe over HTTPS.

Recognizing Base64 by how it starts

Files begin with fixed signature bytes, so their Base64 begins with fixed characters too. With practice you can tell what a blob of Base64 holds at a glance:

Starts withIt is
iVBORw0KGgoPNG image
/9j/JPEG image
R0lGODGIF image
JVBERi0PDF document
UEsDBZIP archive, including .docx, .xlsx and .apk files
H4sIGzip-compressed data
eyJJSON starting with {", very often a JSON Web Token

Text, UTF-8 and the emoji problem

Base64 encodes bytes, not letters, so text has to be turned into bytes first, and the choice of encoding matters. This tool uses UTF-8, the encoding of almost the entire web. Many quick converters call the browser's btoa() directly, which only accepts characters from the Latin-1 range and fails on emoji, Chinese, Greek or curly quotes. Here, "Grüße 👋" encodes and decodes back exactly.

When not to use it

Base64 is not a security measure: it hides nothing from anyone who looks. It is also a poor way to ship large images on a website. A data URI makes the page a third heavier, cannot be cached separately and blocks the page while it downloads. Keep data URIs for icons of a few kilobytes and serve everything else as a normal file.

Frequently Asked Questions

What is Base64?
Base64 is a way to write any data, including images and other binary files, using only 64 safe printable characters: A to Z, a to z, 0 to 9, + and /. It lets binary data travel through systems built for text, such as email, JSON and HTML.
Is Base64 encryption?
No. Base64 is an encoding, not encryption, and anyone can decode it instantly with no key. Never use it to hide passwords or personal data. If something needs to be secret, it needs real encryption.
Why is the Base64 version bigger than the original?
Base64 turns every 3 bytes into 4 characters, so the result is about 33% larger, plus up to two = signs of padding at the end. That overhead is the price of being able to send binary data through text-only channels.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs and file names. The URL-safe variant, defined in RFC 4648, uses - and _ instead and usually drops the = padding. JSON Web Tokens use it. The decoder here accepts both forms automatically.
Why do I see a broken image or no preview?
Either the Base64 is incomplete, which often happens when a long string is cut off while copying, or the data is not an image. The decoder identifies common file types from their first bytes and only previews images; anything else is offered as a download.
Why does my decoded text look like gibberish?
If the result is shown as hex, the decoded bytes are not UTF-8 text. They may be an image, a PDF or a compressed file, which you can download, or text saved in an older encoding such as UTF-16 or Windows-1252, which this tool does not convert. If the result is readable but looks like a jumble of letters and digits, the data was probably Base64-encoded twice, so decode the result again.
Is there a size limit?
Files up to 25 MB can be encoded. Pasted text has no fixed limit, but very large strings slow the browser down. Everything is processed on your device, so nothing is uploaded.
The Internet Omni-Tool