Base64 Encoder / Decoder

Encode text to Base64 or decode it back — instantly and privately in your browser.

Runs in your browserUpdated Built and maintained by Leon and Henrik

Paste text to encode it as Base64, or paste Base64 to decode it back. Free. No sign-up. Runs in your browser, nothing is uploaded.

Base64 Encoder / Decoder
Runs in your browser
Nothing is uploaded

Choose Encode to turn text into Base64, or Decode to read Base64 as text. The result appears as you type; Copy puts it on the clipboard. Encoding has a URL-safe option that uses - and _ and drops the = padding. Decoding accepts both variants, ignores whitespace and line breaks, and strips a leading data:…;base64, prefix for you.

What Base64 does to your data, byte by byte

Base64 takes three bytes (24 bits) at a time and splits them into four 6-bit groups. Each group picks one of 64 characters: A–Z, a–z, 0–9, + and /. The classic example:

  • Man = bytes 77, 97, 110 → bits 010011 010110 000101 101110 → T W F u → TWFu

When the input isn't a multiple of three bytes, the last group is padded with =:

InputBytesBase64
Man3TWFu
Hi2SGk=
H1SA==
Hello5SGVsbG8=
é2 (UTF-8)w6k=
😀4 (UTF-8)8J+YgA==

How much bigger does Base64 make a file?

Every 3 bytes become 4 characters, so the output length is 4 × (bytes ÷ 3, rounded up):

Original sizeBase64 length
10 bytes16 characters
100 bytes136 characters
1,000 bytes1,336 characters
1 MB (1,048,576 bytes)1,398,104 characters (≈ 1.33 MB)

That 33% overhead is why Base64 suits small things: an icon inlined in CSS as a data URI, a signature in a JSON field, a short token. For a 2 MB photo, a normal file upload is the better route. Email adds line breaks every 76 characters on top, so attachments grow a little more than a third.

Recognizing what a Base64 string contains

If decoding gives you "binary data" in place of text, the first few characters usually reveal the file type, because every format starts with the same signature bytes:

Starts withIt's probably
eyJJSON beginning with {" (also the start of every JWT)
iVBORw0KGgoPNG image
/9j/JPEG image
R0lGODGIF image
JVBERi0PDF document
UEsDBZIP archive, or a DOCX/XLSX, which are ZIP files inside

A string starting with eyJ and containing two dots is a JSON Web Token; the JWT Decoder splits it into header and payload for you.

Standard vs. URL-safe Base64

+ and / mean something inside URLs, and = does too in query strings. URL-safe Base64 (also called base64url) replaces them with - and _ and usually leaves off the padding. JWTs and many API tokens use it. ?>? shows the difference: standard Pz4/, URL-safe Pz4_.

Tick URL-safe when the result has to go into a link, a filename or a cookie. When decoding you don't need to choose: both forms are recognized automatically. For percent-encoding whole URLs, use the URL Encoder.

Base64 is not a way to hide anything

HTTP Basic Authentication sends user:pass as dXNlcjpwYXNz, and that header is readable by anyone who intercepts it, which is why Basic Auth is only safe over HTTPS. The same goes for "obfuscated" API keys in config files or front-end code: Base64 is a costume, not a lock. To check whether two values are identical without revealing them, use a hash from the Hash Generator; for real secrecy, use actual encryption.

When the decoded text turns out to be a block of JSON, the JSON Formatter makes it readable. Encoding and decoding both run in your browser, so tokens and keys you paste here aren't sent anywhere.

Frequently asked questions