What is Base64 encoding?
Base64 is a way to represent arbitrary bytes using only printable ASCII characters. It takes every three bytes of input, groups their 24 bits into four 6-bit chunks, and maps each chunk to one of 64 symbols: uppercase letters, lowercase letters, digits, +, and /. If the input length is not a multiple of three, padding with = is added at the end.
The encoding increases size by roughly 33%, but the result can be pasted into JSON, XML, email bodies, query strings, and log files without corrupting special characters. That is why APIs return small binary blobs as Base64 strings and why developers reach for Base64 when a transport layer is text-only.
This encoder and decoder runs entirely in your browser. Paste plain text to encode it, or paste a Base64 string to recover the original text. Switch between modes with one click, load a sample to try the tool, and copy the output when you are done. No account, no upload, no waiting.
How to use the Base64 encoder and decoder
- Choose a mode. Select Encode to turn plain text into Base64, or Decode to reverse the process.
- Paste your input into the left panel. Click Load sample if you want to see an example first.
- Click Convert. The result appears in the right panel. If the input is invalid Base64 during decode, an error message explains what went wrong.
- Copy the output with the Copy button above the result panel, or click Clear to start over.
Examples
Encoding plain text
Input: Hello, World!
Output: SGVsbG8sIFdvcmxkIQ==The output is longer than the input because each group of three characters becomes four Base64 symbols. The trailing == is padding - it tells the decoder that the last group was not a full three bytes.
Decoding back to text
Input: SGVsbG8sIFdvcmxkIQ==
Output: Hello, World!Decoding is deterministic: the same Base64 string always produces the same bytes. If you are debugging API responses that contain Base64 fields, pair this tool with the JSON Formatter to inspect the surrounding structure first.
Base64 vs other encodings
Base64 is often confused with URL percent-encoding or hexadecimal representation, but they serve different jobs. Percent-encoding (also called URL encoding) replaces unsafe characters in URLs with %XX sequences - useful for query parameters, not for arbitrary binary. Hex encoding doubles every byte into two characters and is common in cryptography and checksums. Base64 is more compact than hex and handles full byte ranges, which is why it dominates web APIs and data URIs.
For URL query values specifically, use the dedicated URL Encoder Decoder, which applies encodeURIComponent or encodeURI rules instead of Base64.
Common pitfalls
- Line breaks in pasted Base64. Email clients and some editors wrap long strings. This tool strips whitespace before decoding, so wrapped input usually works without manual cleanup.
- UTF-8 text. The encoder uses UTF-8 bytes before applying Base64, so accented characters and emoji encode and decode correctly in modern browsers.
- Assuming encryption. Base64 is reversible by design. If you need confidentiality, use TLS in transit and proper encryption at rest - not Base64.
- Binary files. This tool is optimized for text. Large files or non-text binary are better handled with dedicated file utilities or command-line tools like
base64on Linux and macOS.
When developers reach for Base64
You will see Base64 in Basic Authentication headers, where username:password is encoded and sent after the Basic prefix. Data URIs embed small images directly in HTML or CSS as data:image/png;base64,.... Some databases and NoSQL stores store binary columns as Base64 strings in JSON exports. JWT tokens use Base64url (a URL-safe variant) for their header and payload segments.
Understanding encode and decode is a basic skill for API debugging, log analysis, and quick data inspection. Keep this tool bookmarked next to the Unix Timestamp Converter and JSON Validator for a complete browser-side debugging kit.