Base64 encoder and decoder
Base64 is a way of writing any data — text, images, PDFs, keys — using only 64 safe characters: A–Z, a–z, 0–9, + and /. This tool encodes text and files to Base64 and decodes Base64 back to readable text or the original file. Conversion happens instantly in your browser, and nothing you paste or select is uploaded.
What it can do
- Encode text to Base64 with proper UTF-8 handling, so any language and emoji are supported.
- Decode Base64 to text, tolerating line breaks, spaces and missing padding — common when copying from emails or logs.
- Base64URL mode for URL-safe output, used by JWTs, OAuth and many web APIs.
- File to Base64, with an option to output a complete
data:URL ready for an<img src>or CSSurl(). - Base64 to file: download the decoded bytes when the content is binary, such as an image or PDF.
Where Base64 is used
Email attachments. The MIME standard encodes attachments in Base64 so binary files survive transport through systems designed for text.
Data URLs. Small icons and images can be embedded directly into HTML or CSS as data:image/png;base64,…, saving an extra network request.
APIs and configuration. Binary values such as certificates, encryption keys or file uploads are often sent inside JSON as Base64 strings. Kubernetes secrets and many environment variables also store values in Base64.
Authentication. HTTP Basic authentication sends username:password encoded as Base64, and JSON Web Tokens are three Base64URL-encoded parts. To inspect a token's contents, use the JWT Decoder.
How Base64 works
The encoder takes the input three bytes (24 bits) at a time and splits them into four 6-bit groups. Each 6-bit value (0–63) maps to one character of the Base64 alphabet. When the input length is not a multiple of three, the output is padded with one or two = signs so its length is a multiple of four.
Because each 3 bytes become 4 characters, Base64 data is about one third larger than the original. That overhead is the price of being able to pass binary data safely through text-only systems.
Base64 is not the same as URL encoding. If you need to put arbitrary text into a query string, use URL Encode/Decode instead. To check whether two files are identical, compare their checksums with the Hash Generator.