What each conversion is for
| Conversion | Typical use | Example |
|---|---|---|
| Base64 | Binary data in JSON, email attachments, Basic auth headers | Hello → SGVsbG8= |
| Base64URL | JWTs and values that go into URLs | <<? → PDw_ |
| URL | Query string values and path segments | a b&c → a%20b%26c |
| HTML entities | Showing user text safely inside HTML | <b> → <b> |
| JSON string | Putting text inside a JSON value, or reading an escaped payload from a log | line "1" → "line \"1\"" |
| Hex | Looking at raw bytes, hashes and binary protocols | Hi → 4869 |
| Unix timestamp | Reading created_at values, JWT exp claims and log times | 1700000000 → 2023-11-14T22:13:20Z |
Pages for the most common jobs: Base64 decoder (with image and PDF preview), URL encoder and decoder and JSON escape and unescape.
Unicode works properly
JavaScript's built-in btoa() fails on text like café or emoji. This tool converts text to UTF-8 bytes first, so every character round-trips correctly and the Base64 matches what Java, Python and most servers produce.
Unescaping JSON from logs
Logs and message queues often store a JSON payload as an escaped string, full of \" and \n. Choose JSON string and Decode to turn it back into readable JSON. If the result is JSON itself, it is formatted for you.
Decoding files
When Base64 or hex decodes to something that isn't text, such as an image or a zip archive, you'll see the bytes as hex, a hint about the file type, and a Download button. Going the other way, File to Base64 encodes any file up to 10 MB without uploading it.
Base64 encoding in code and on the command line
// JavaScript (browser), UTF-8 safe
const b64 = btoa(String.fromCharCode(...new TextEncoder().encode(text)));
// Node.js
Buffer.from(text, 'utf8').toString('base64');
// Java
Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8));
# Python
base64.b64encode(text.encode('utf-8')).decode('ascii')
# Linux and macOS
echo -n 'Hello' | base64 # SGVsbG8=
base64 -w 0 logo.png > logo.txt # GNU coreutils; on macOS: base64 -i logo.png Use echo -n: without it the trailing newline is encoded too, and you get SGVsbG8K instead of SGVsbG8=.
Base64 encode an image
Choose Base64, then File to Base64, and pick the image. To embed it in HTML or CSS, put the data URL prefix shown under the output in front of it: <img src="data:image/png;base64,iVBORw0…">. Base64 makes a file about a third larger, so it suits icons and small images rather than photos. To go the other way, use the Base64 decoder, which previews the image.
Frequently asked questions
Is Base64 encryption?
No. Base64 only changes how bytes are written so they survive systems that expect text. Anyone can decode it, so it gives no protection to passwords or other secrets.
What's the difference between Base64 and Base64URL?
Base64URL uses - and _ instead of + and / and usually drops the = padding, so the result can go into URLs and file names without escaping. JWTs use Base64URL. The decoder here accepts both.
Why does decoding show hex instead of text?
The decoded bytes aren't readable UTF-8 text, for example an image or a zip file. The tool shows them as hex, tells you what kind of file they look like, and lets you download them.
Is the timestamp in seconds or milliseconds?
It's detected from the number of digits: up to 11 digits is read as seconds, 12 to 13 as milliseconds, and longer numbers as microseconds or nanoseconds. The result says which one was used.