Base64 Encoder & Decoder
Encode and decode Base64 with support for text, files, and the URL-safe variant. Runs entirely in your browser.
// output appears here as you typeEncode or decode in two clicks.
- 01Choose encode or decode.The toggle at the top sets the direction. Encoding turns plain text or files into Base64. Decoding turns Base64 back into readable text.
- 02Type, paste, or upload a file.The output appears live as you type. For files, click the “file” button — images, PDFs, archives, anything works. The file is processed in your browser; nothing is uploaded.
- 03Need URL-safe? Toggle it on.URL-safe Base64 replaces
+and/with-and_, and removes padding — useful for tokens, URLs, and filenames.
What is Base64, really?
Base64 is an encoding scheme that represents binary data using only 64 printable ASCII characters. It was designed for systems that handle text but not arbitrary bytes — early email, URLs, XML, JSON. Base64 is defined in RFC 4648.
The mechanism is simple: every 3 bytes of input (24 bits) are split into 4 groups of 6 bits, and each 6-bit group is mapped to one of 64 characters. When the input length isn't a multiple of 3, padding (=) fills the gap.
The 64-character alphabet uses A-Z, a-z, 0-9, plus two extras. Standard Base64 uses + and /; URL-safe Base64 uses - and _ instead, since the standard characters have special meaning in URLs.
Common real-world uses
- →Embedding images directly in HTML/CSS via data: URIs
- →Transmitting binary content in JSON APIs
- →Encoding the header and payload sections of JWTs (URL-safe variant)
- →Including binary attachments in MIME emails
- →Encoding credentials in HTTP Basic Auth headers
- →Storing binary data in environment variables or YAML configs
Things to avoid
- ×Using Base64 as a form of encryption — it isn't, anyone can decode it
- ×Encoding files larger than necessary in JSON payloads (33% overhead adds up fast)
- ×Mixing Base64 variants — pick standard or URL-safe and stick to it
- ×Forgetting padding when concatenating Base64 strings