About this tool
Encode UTF-8 text to Base64 or decode standard Base64 back to text, including non-Latin characters and emoji. Common for API debugging, config values and simple data transfer.
Typical uses
- Decode a Base64 string from an API response
- Encode a config value containing non-ASCII text
- Read Base64 content in email or logs
How to use
Enter UTF-8 text or a standard Base64 string.
Encode or decode, then copy or download the result.
This handles text, not binary files. Input is limited to one million characters.
From text to Base64: UTF-8 bytes first
When you press “Encode”, the tool turns the text into UTF-8 bytes, then writes every 3 bytes as 4 characters from the standard RFC 4648 alphabet (A–Z, a–z, 0–9, + and /), padding a short final group with =. The table was produced by the tool’s own encoder:
| Text | UTF-16 length | UTF-8 bytes | Base64 |
|---|---|---|---|
| "Doc80" | 5 | 5: 44 6F 63 38 30 | RG9jODA= |
| "你好" | 2 | 6: E4 BD A0 E5 A5 BD | 5L2g5aW9 |
| "東京タワー" | 5 | 15: E6 9D B1 E4 BA AC E3 82 BF E3 83 AF E3 83 BC | 5p2x5Lqs44K/44Ov44O8 |
| "café" | 4 | 5: 63 61 66 C3 A9 | Y2Fmw6k= |
| "Mañana" | 6 | 7: 4D 61 C3 B1 61 6E 61 | TWHDsWFuYQ== |
| "😀" | 2 | 4: F0 9F 98 80 | 8J+YgA== |
| "???" | 3 | 3: 3F 3F 3F | Pz8/ |
| "a↵b" | 3 | 3: 61 0A 62 | YQpi |
- Accented letters need two bytes in UTF-8, so “café” is 5 bytes and “Mañana” is 7. A system that uses Windows-1252 or Latin-1 would produce a different Base64 string for the same word, and the decoder must use the same encoding. This tool always uses UTF-8.
- The emoji “😀” is 4 bytes and ends with two = signs. It counts as 2 characters (UTF-16 units) in the input, which is also how the one-million-character limit is measured.
- Output is always a single line with no line breaks, and padding is always included. RFC 4648 section 3.1 says implementations must not add line feeds unless the referring specification asks for them; MIME e-mail limits lines to 76 characters, so wrap the result yourself if you need that format.
- Line breaks in a browser text box are always LF (the HTML standard normalises a textarea’s value to LF). Typing “a↵b” therefore gives YQpi; the same content saved with Windows CRLF line endings encodes to YQ0KYg==, so the two strings cannot be compared directly.
One third bigger: the exact numbers
Base64 length = 4 × ⌈bytes ÷ 3⌉. Small inputs grow by more, and large ones approach 4/3 (about 1.333):
| Bytes | Base64 characters | Padding | Ratio |
|---|---|---|---|
| 1 | 4 | == | 4 |
| 2 | 4 | = | 2 |
| 3 | 4 | — | 1.333 |
| 4 | 8 | == | 2 |
| 5 | 8 | = | 1.6 |
| 6 | 8 | — | 1.333 |
| 100 | 136 | == | 1.36 |
- Both directions accept at most 1,000,000 input characters; beyond that you see “Input is limited to 1 million characters.”
- At the limit, one million ASCII characters encode to 1,333,336 Base64 characters, and one million Chinese characters (3,000,000 bytes) to 4,000,000.
- In the other direction, one million Base64 characters decode to at most 750,000 bytes. A long text you encoded here can therefore produce a result that is too long to paste back for decoding.
- Base64 is not encryption. RFC 4648 section 12 states that base encoding provides no confidentiality: anyone can reverse it. Passwords and personal data need real encryption.
What decoding accepts and rejects
“Decode” first deletes every whitespace character (line breaks, tabs, even the ideographic space U+3000), hands the rest to the browser’s atob, and finally decodes the bytes as strict UTF-8. These are the tool’s actual results:
| Input (↵ = line break) | Result | Why |
|---|---|---|
| 5L2g↵5aW9 | "你好" | Whitespace and line breaks are removed, so MIME Base64 wrapped at 76 characters decodes as is |
| 5L2g[U+3000]5aW9 | "你好" | The ideographic space is removed too |
| "A" | Missing = padding is accepted | |
| QQ= | Base64 error | When the length is not a multiple of 4, a trailing = is not stripped, so it is invalid |
| QR== | "A" | Unused trailing bits are ignored: QQ== and QR== both give A |
| QQ==QQ== | Base64 error | = may only appear at the end, so two concatenated Base64 strings fail |
| Pz8_ | Base64 error | The URL-safe characters - and _ are not accepted |
| Pz8/ | "???" | Swap _ back to / and - back to + and it decodes |
| 77u/5L2g5aW9 | "你好" | A leading UTF-8 byte order mark (EF BB BF) is dropped |
| 5L2g5aW | UTF-8 error | The string was cut off; the last Chinese character has only 2 of its 3 bytes |
| 5L2g5 | Base64 error | A character count that leaves remainder 1 when divided by 4 can never be valid Base64 |
| iVBORw0KGgo= | UTF-8 error | This is a PNG file signature: binary data, not UTF-8 text |
- On an error the page shows “Input is not valid Base64 or UTF-8 text.”. The same message covers both an invalid Base64 string and decoded bytes that are not valid UTF-8; the table above shows which inputs cause which.
- The URL-safe variant (base64url, RFC 4648 section 5) replaces + with - and / with _. It is used in JWTs and URL parameters. Swap the two characters back before decoding; missing = signs do not need to be added.
- Base64 for images, PDFs and other binary files cannot be decoded here because the result is not text; the tool handles text only.
Sources
Frequently asked questions
Can it encode images or files?
This tool handles text. Use the image Base64 converter for images.
Is Base64 encryption?
No. It is only an encoding that anyone can decode; do not use it to protect secrets.
Input limit?
Up to 1 million characters.
Suggest an improvement to this tool
Missing an option, something awkward to use, or a wrong result? Let us know.