Base64 Encoder & Decoder
Encode and decode Base64 text or files locally in your browser.
Loading Base64 Encoder & Decoder… If nothing happens, please enable JavaScript.
Frequently asked questions
Is my data uploaded to a server?
What exactly are those 64 characters Base64 uses?
When should I use Base64 encoding in my own projects?
How does Base64 compare to hex encoding?
What is the maximum file size I can encode or decode?
Does it work offline and in all modern browsers?
Can I encode binary files such as images or PDFs?
Is Base64 a form of encryption?
What is the difference between standard Base64 and Base64url?
Why do I sometimes get an 'invalid character' error when decoding?
About Base64 Encoder & Decoder
Base64 is a binary-to-text encoding scheme that represents binary data using only 64 printable ASCII characters — the uppercase and lowercase Latin alphabet, the digits 0–9, and the symbols + and /. It was standardised in 1987 as part of RFC 989 for Privacy Enhanced Mail, and later formalised in RFC 4648. The name comes from the fact that each output character encodes exactly 6 bits, meaning every 3 bytes of binary input become exactly 4 ASCII characters — a 33 % size overhead that is well worth the compatibility gain.
Developers reach for Base64 every day without always realising it. Data URIs that embed images or fonts directly in HTML and CSS use Base64. JSON Web Tokens use Base64url (a URL-safe variant) to pack their header and payload. HTTP Basic Authentication encodes credentials as Base64 before placing them in the Authorization header. TLS certificates, SSH keys, and PGP armored messages are all distributed as Base64-wrapped PEM files. Any time binary data must survive a text-only transport or storage layer — email, JSON, XML, environment variables — Base64 is the standard answer.
This tool encodes and decodes Base64 entirely inside your browser. It uses the platform's built-in btoa/atob functions for text and the FileReader API for binary file uploads. Because all processing happens on your own device, your data is never transmitted to any server — making it safe to use with sensitive credentials, private keys, or confidential documents. The tool also supports URL-safe Base64, which replaces + with - and / with _ so that the output can be embedded in URLs without percent-encoding.
A few things to watch out for: btoa throws a TypeError if the input contains characters outside the Latin-1 range, so the tool automatically UTF-8 encodes Unicode text before encoding. When decoding, trailing padding characters (=) are optional in many implementations but some strict parsers require them — if you receive a decoding error, try appending one or two = signs. Base64 is an encoding, not encryption: it provides zero confidentiality, and anyone can decode it instantly. Never store passwords or tokens in Base64 expecting any security benefit.
The origins of Base64
Base64 was standardised in 1987 as part of RFC 989, which defined Privacy Enhanced Mail (PEM) for secure email exchange. The name comes from the fact that the encoding uses exactly 64 printable ASCII characters — the largest power-of-two subset that fits comfortably in most character encodings of the era. The scheme was later refined in RFC 1421 and definitively documented in RFC 4648 (2006), which remains the authoritative reference today.
Before Base64, sending binary data over email systems was notoriously unreliable. Early mail relays operated on 7-bit ASCII and would silently corrupt bytes above 127, treating them as control codes or stripping the high bit entirely. Base64 solved this by mapping every 3 bytes of binary input into 4 printable characters drawn from a safe, universally supported subset of ASCII, guaranteeing faithful transit through any text-only channel.
Today, Base64 is woven into the fabric of the web. A modern browser processes thousands of Base64 operations per page load without the user ever noticing — decoding font files embedded in CSS, verifying JWT tokens in API responses, rendering inline images in email clients, and validating TLS certificates during the HTTPS handshake. What began as a workaround for flawed 1980s mail infrastructure has become one of the most quietly essential encodings in computing.