Base64 Encode / Decode
Encode UTF-8 text to Base64, or decode Base64 back to text. Everything stays in your browser.
How Base64 Encode / Decode works
What Base64 is for
Base64 represents any bytes using only 64 safe characters (A-Z, a-z, 0-9, +, /), with = as padding. It exists so that binary data or arbitrary text can pass through channels that only accept plain text: HTTP Basic authentication headers, data: URLs, email attachments, JSON fields, and Kubernetes secrets.
Base64 is an encoding, not encryption. Anyone can decode it, so it hides nothing. The output is also about a third larger than the input, since every 3 bytes become 4 characters.
UTF-8 handling
The browser's built-in btoa() function fails on any character outside Latin-1, so btoa("✓") throws an error. This tool first converts your text to UTF-8 bytes and then encodes those bytes. That is how most servers and libraries do it, so the output matches Python's base64.b64encode(s.encode()) or echo -n ... | base64 on the command line.
Decoding reverses the process and reads the bytes as UTF-8. Spaces and line breaks in the input are ignored, so Base64 wrapped at 76 characters, as in email bodies and PEM files, decodes without cleanup.
Limits
This is a text tool. Decoding Base64 that represents an image, a PDF, or another binary file produces unreadable characters, because those bytes are not text. URL-safe Base64, which uses - and _ instead of + and / (as in JSON Web Tokens), needs those two characters swapped back before decoding. Missing padding may also need adding.
Example
The ï and ✓ are encoded as UTF-8 bytes, so this decodes correctly in any standard Base64 library.
{"user":"anaïs","role":"admin"} ✓eyJ1c2VyIjoiYW5hw69zIiwicm9sZSI6ImFkbWluIn0g4pyTHow to use Base64 Encode / Decode
- 1
Choose Encode or Decode.
- 2
Paste the text or Base64 string.
- 3
Read the result, or the error message if the Base64 is invalid.
- 4
Copy the output or download it as a file.
When to use it
Authorization headers
Build or inspect the user:password value of an HTTP Basic auth header.
Config and secrets
Read Base64 values in Kubernetes secrets or CI variables, or encode new ones.
Base64 Encode / Decode questions
Why do I get an error when decoding?
The input contains characters outside the Base64 alphabet, or its length is wrong. URL-safe Base64 (with - and _) must be converted to standard Base64 first.
Can I decode a JWT here?
Each JWT segment is URL-safe Base64 without padding. Replace - with + and _ with /, add = until the length is a multiple of 4, then decode one segment at a time.
Can I encode a file or image?
No, the tool encodes text you paste. Use base64 on the command line for binary files.
Questions about privacy, file size, or accounts are answered on the FAQ page.
More encode & decode
Other tools in the same category
URL Encode / Decode
Percent-encode text for use in a URL, or decode percent-encoded query strings and paths
HTML Entities
Escape text so it displays literally in HTML, or decode entities such as & and ' back to characters
JSON Preview
View a JSON array of objects as a table, with one column per key