What is Base64?
Base64 is a way of writing any binary data, such as images, files or encrypted bytes, using only plain text characters. It's used wherever binary has to travel through a text-only channel: email attachments, data URLs in HTML and CSS, JSON API payloads, HTTP Basic authentication headers and JSON Web Tokens.
This tool encodes and decodes Base64 and Base64url for text, handling Unicode properly through UTF-8, and converts files into data URLs you can paste into code. When decoded data isn't text, it tells you so and shows the first bytes in hexadecimal.
How to use the Base64 Encoder
1.Choose encode or decode
Encode turns text into Base64; decode turns Base64 back into text.
2.Paste your text
Emoji and non-English text work, as UTF-8. Tick URL-safe for tokens and URLs.
3.Or pick a file
Get a data URL for an image or file up to 5 MB, read in your browser.
Example: text and its URL-safe form
Encoding a few short strings:
- Hello
- SGVsbG8=
- Hi?>
- SGk/Pg== (standard)
- Hi?> URL-safe
- SGk_Pg (no / and no padding)
The / in standard Base64 would need escaping in a URL, which is why tokens use the URL-safe alphabet.
How Base64 works
Base64 turns every 3 bytes into 4 characters from a 64-character alphabet (A–Z, a–z, 0–9, + and /), padding the end with =. Output is about a third larger than the input. Text is converted to UTF-8 bytes first, which is why this tool handles Hindi and emoji correctly where the browser's plain btoa() fails.
Base64url, used in JWTs and URLs, swaps + and / for - and _ and drops the padding, so the result can sit in a URL without escaping. Decoding accepts both forms.
Frequently asked questions
Is Base64 encryption?
No. It's an encoding anyone can reverse. Never use it to hide passwords or secrets.
What does "Hello" look like in Base64?
SGVsbG8=. The = is padding because 5 bytes isn't a multiple of 3.
Why did decoding show binary data?
The bytes aren't valid UTF-8 text, for example an image or a compressed file. The tool shows the size and first bytes instead.
When should I use a data URL?
For small images or fonts embedded directly in HTML or CSS. Large files are better served normally, since Base64 makes them a third bigger.
Related tools
URL Encoder & Decoder
Percent-encode or decode URLs and query values, and see a URL's parts.
JWT Decoder
Decode a JSON Web Token's header and payload and check its expiry.
Hash Generator: MD5, SHA-1, SHA-256
MD5, SHA-1 and SHA-256 hashes of text or files, with checksum compare.
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.