Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text.
What is Base64?
Base64 writes any sequence of bytes using 64 safe characters — A–Z, a–z, 0–9, + and / — plus = for padding, so binary data can travel through places that only accept text, such as JSON fields, email, HTTP headers and data URLs. Every 3 bytes become 4 characters, which makes the encoded form about a third larger than the original. This tool converts between Base64 and either UTF-8 text or bytes written as hexadecimal.
How to Use the Base64 Encoder / Decoder
- Choose a mode: Text → Base64 and Base64 → Text work with readable UTF-8 text; Hex → Base64 and Base64 → Hex work with raw bytes written as hexadecimal, such as keys, hashes or file and image bytes.
- Paste your input, run the conversion and copy the result. After a successful conversion, switching modes moves the result into the input, so you can convert it back or into the other format.
- If Base64 → Text rejects input you know is standard Base64, the decoded bytes are probably binary rather than text: use Base64 → Hex to see them.
Technical Notes
- Text → Base64 encodes your text as UTF-8 before converting it. Base64 → Text decodes the bytes as UTF-8 and only succeeds when they form valid UTF-8; text originally saved in another encoding, such as Latin-1 or UTF-16, may be rejected or come out garbled.
- The decoder accepts standard Base64 only: the + and / characters, with = padding so that the length is a multiple of 4. Spaces and line breaks are ignored, so line-wrapped Base64 can be pasted as it is. URL-safe Base64 (Base64url, which uses - and _), unpadded input and data: URI prefixes are not accepted — JWT segments, for example, are unpadded Base64url and cannot be pasted directly. Encoding always produces padded, standard Base64 on a single line.
- Base64 can carry arbitrary bytes, not only text. When the decoded bytes are binary — a key, a hash, part of a file or an image — Base64 → Text usually reports an error even though the Base64 itself is fine; Base64 → Hex shows those bytes as lowercase hexadecimal, two digits per byte, with no separators.
- Hex input must consist of pairs of hexadecimal digits (0–9 and a–f, in upper or lower case), so the number of digits must be even. Spaces and line breaks between digits are allowed, but a 0x prefix and colon separators (as in 48:65) are not.
Frequently Asked Questions
What is Base64 used for?+
Common uses include embedding small images or fonts in HTML and CSS as data: URLs, email attachments (MIME), binary values such as keys, certificates or signatures inside JSON, XML or HTTP headers, and the user:password pair in HTTP Basic authentication. To decode a data: URL here, paste only the part after the comma.
Why won't my Base64 decode?+
The usual causes are URL-safe Base64 that uses - and _ instead of + and /, missing = padding (the length must be a multiple of 4), a data: URI prefix left in front of the data, or — in Base64 → Text — decoded bytes that are binary rather than UTF-8 text. For URL-safe or unpadded input, replace - with + and _ with /, then add = until the length is a multiple of 4; for binary data, use Base64 → Hex.
Does this tool support Unicode and emoji?+
Yes. Text is converted to UTF-8 before encoding, so accented letters and emoji become their multi-byte UTF-8 sequences — é is 2 bytes, most emoji are 4 — and decoding reverses this. A tool that encodes text as UTF-16 or Latin-1 produces different Base64 for the same characters.
Is my data sent to any server?+
No. All encoding and decoding runs 100% locally inside your web browser. No data is transmitted across the network.
