Base64 encoder and decoder that handles UTF-8 and binary properly
Base64 is easy to get subtly wrong: standard versus URL-safe alphabet, newline padding, and text that is not ASCII. This tool does the conversion correctly for all three and shows you exactly which variant it produced.
- Alphabets
- Standard + URL-safe
- Encoding
- UTF-8 aware
- Binary
- Supported
How to use it
- Paste the value Type or paste the text to encode, or the Base64 string to decode. Decoding is detected automatically, so you do not need to switch modes first.
- Pick the variant Standard Base64 uses + and / and pads with =. URL-safe Base64 swaps them for - and _ and can drop the padding, which is what JWT and URL query parameters require.
- Copy the result The output shows the encoded string, its length before and after, and a ready-made data URI when the input looks like binary.
Reference
The same payload in both alphabets
| Input | Standard | URL-safe |
|---|---|---|
| `{"a":1,"b":"x?y"}` | `eyJhIjoxLCJiIjoiePx5In0=` | `eyJhIjoxLCJiIjoiePx5In0=` |
| `binary bytes 0xFB 0xFF` | `+/8=` | `-_8=` |
Questions people ask
Is Base64 encryption?
No. It is a reversible encoding with no key. Treat a base64-encoded value as plain text for confidentiality purposes, and encrypt anything that genuinely needs protecting.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / for the last two alphabet characters and pads with =. The URL-safe variant, defined in RFC 4648 section 5, replaces them with - and _ and usually drops the padding so the result can be placed in a URL without escaping.
Why did my Base64 decode to garbage?
Most often the string was encoded from binary rather than text and you are viewing it as a string. Second most common: the input is URL-safe Base64 that a strict standard decoder rejected — this decoder accepts both. Third: the string was truncated in transit, which you can spot in the length readout.
Does it handle emoji and non-Latin characters?
Yes. Text is converted to UTF-8 bytes before encoding, so emoji, accented letters, Cyrillic, Arabic and CJK text all round-trip correctly.
How large a file can I encode?
Text of a few megabytes is comfortable. For files, note that Base64 adds roughly a third in size, which is usually a bad trade compared with sending the file itself over HTTP.
Can I decode a Base64 image?
Yes, and the output includes the data URI form so you can paste it straight into an image tag or a stylesheet. The decoder also reports whether the decoded bytes look like a recognised image format.
Details that catch people out
Base64 is a transport encoding with no key and no confidentiality. Anyone can decode it, and a secret that is only base64-encoded is a secret that is public. It protects nothing against someone who can read the string.
A standard Base64 string is padded with = to a multiple of four characters. URL-safe variants usually strip the padding. Decoders in strict mode will reject a string whose length and padding disagree, which is why the decoder here is tolerant and reports what it removed.
Where this earns its keep
Building a data URI for an inline image
The output includes the complete `data:image/png;base64,...` prefix, which is what you need to inline a small image in CSS or an email template.
Reading an encoded string from a config file
A base64 secret in a deployment manifest decodes in one step, so you can confirm what a value actually is without touching a terminal.
Preparing a JWT segment
JWTs use the URL-safe alphabet without padding, which is the single most common reason a hand-built token fails signature validation.
Guides that go deeper
- Base64 Is Not Encryption 6 min read · What Base64 actually does, why it is not a security measure, when it is the right tool, and…
- How to Read a JSON Web Token (JWT) 6 min read · A practical guide to reading a JSON Web Token: what the header and payload contain, why the…
Last reviewed 2026-10-10. Every tool on DevSnap runs entirely in your browser, so whatever you paste here never reaches a server.