How to decode or encode Base64
- To decode, paste the Base64 text into the box. The decoded text appears at once. Line breaks and spaces inside the Base64 are ignored, and a whole data URI (
data:…;base64,…) works too. - To encode, choose Encode and type or paste your text — or pick a file to get its Base64 and a ready-made data URI.
- Tick URL-safe Base64 when the result goes into a web address, a file name or a token. Decoding accepts both alphabets automatically.
- Press Copy beside the result. If the input isn’t valid Base64, the message says what is wrong and where.
How Base64 works
Base64 writes any data — text, images, files — using 64 characters that survive email, JSON, HTML and URLs unchanged: A–Z, a–z, 0–9, + and /. It takes the data three bytes (24 bits) at a time and cuts them into four groups of six bits; each group, a number from 0 to 63, picks one character. The standard is RFC 4648.
| M | a | n | |
|---|---|---|---|
| Bytes | 77 | 97 | 110 |
| Bits | 01001101 | 01100001 | 01101110 |
Regrouped into six bits, those 24 bits are 010011 010110 000101 101110 — the numbers 19, 22, 5 and 46, which are the characters T, W, F and u. So “Man” becomes TWFu. When the data doesn’t fill a last group of three bytes, = signs pad the end: “Ma” is TWE= and “M” is TQ==. Four characters for every three bytes is why Base64 is about a third larger than the original.
Text, UTF-8 and the “garbled characters” problem
Base64 encodes bytes, not letters, so text first has to be turned into bytes. This tool uses UTF-8, the encoding of almost every web page and API, so accented letters, Arabic, Chinese and emoji survive the round trip. (A browser’s own btoa() function refuses characters outside Latin-1, a common surprise for developers.) If decoded text shows odd characters such as é where é should be, the original was probably encoded with another character set, such as Windows-1252.
If the decoded bytes aren’t text at all — an image, a PDF, a ZIP file — the tool recognizes common formats from their first bytes and offers the data as a file to download instead.
URL-safe Base64
The + and / characters have special meanings in web addresses, so RFC 4648 also defines a URL- and filename-safe alphabet, often called base64url, with - and _ instead. The = padding is usually left out. JSON Web Tokens (JWTs) use it: their header and payload are base64url-encoded JSON, separated by dots.
Worked example
The sample in the box, SGVsbG8sIHdvcmxkISDwn5GL, is 24 characters long. 24 ÷ 4 × 3 = 18 bytes, and as UTF-8 they spell “Hello, world! 👋”: thirteen one-byte characters, a space and the four bytes of the waving-hand emoji. No = is needed, because 18 bytes divide evenly into groups of three. Encoding ÿþý shows the URL-safe difference: standard Base64 gives w7/DvsO9, URL-safe gives w7_DvsO9.
Errors and what they mean
| Message | Usual cause |
|---|---|
| Base64 can’t contain a character | Something else was copied along: quotes, a comma, a label such as “Authorization:”, or non-Base64 text. |
| Characters can’t make whole bytes | The text was cut off while copying, or one character was added. A valid length leaves a remainder of 0, 2 or 3 when divided by 4. |
| An = sign before the end | Two Base64 strings were joined; decode them separately. |
| Mixes standard and URL-safe Base64 | Parts of two different encodings were pasted together. |
| Binary data, not text | Not an error: the Base64 holds a file. Download it, or check whether you meant to encode. |
Tips and limits
- Base64 is an encoding, not encryption: anyone can decode it. Never treat Base64 as a way to protect passwords or keys.
- Email (MIME) Base64 breaks lines every 76 characters; the decoder ignores the line breaks.
- Files up to 10 MB can be encoded. Long results are offered as text files to download, since a very long block is slow to display and copy.
- Data URIs (
data:image/png;base64,…, RFC 2397) put a small file straight into HTML or CSS. They suit icons and small images; large images load better as separate files. - To see the bytes themselves as 0s and 1s, use the binary translator; to tidy decoded JSON, the JSON formatter.
Everything runs in your browser: what you paste and the files you choose are never uploaded, and nothing is saved.
Frequently asked questions
Is Base64 encryption?
No. Base64 only changes how data is written, and anyone can decode it without a key. It is used so binary data can travel through systems built for text, not to keep it secret.
Why does Base64 end with = or ==?
The = signs are padding. Base64 works on groups of three bytes; when the data ends with one leftover byte, two = signs fill the group, and with two leftover bytes, one = does. Many systems, such as JWTs, leave the padding out — this decoder adds it back automatically.
How do I decode a JWT?
Split the token at the dots and paste the first part (the header) or the second (the payload) into the box: both are URL-safe Base64 of JSON. The third part is a signature, which isn’t text. Decoding doesn’t check the signature, and anyone holding a token can read its payload, so tokens shouldn’t carry secrets.
Why is my decoded text garbled?
Either the Base64 holds binary data rather than text — the tool then offers it as a file — or the text was encoded with a character set other than UTF-8, such as Windows-1252, so accented letters come out as pairs of odd characters.
How much bigger does Base64 make a file?
About 33%: every 3 bytes become 4 characters, plus up to two padding characters. A 300 KB image becomes about 400 KB of Base64, a little more with line breaks.
Last updated: October 15, 2026