~/base64

Base64 Encoder & Decoder

Encode and decode Base64 with support for text, files, and the URL-safe variant. Runs entirely in your browser.

plain text0 chars
base64 output
// output appears here as you type
// how to use

Encode or decode in two clicks.

  1. 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.
  2. 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.
  3. 03Need URL-safe? Toggle it on.URL-safe Base64 replaces + and / with - and _, and removes padding — useful for tokens, URLs, and filenames.
// background

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
// faq

Frequently asked questions.

What's the difference between standard Base64 and URL-safe Base64?+
Standard Base64 (RFC 4648 §4) uses + and / characters and = for padding. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _ and drops the padding. Use URL-safe when embedding Base64 in URLs, JWTs, or filenames where special characters cause issues.
Why does Base64 encoding make my data ~33% larger?+
Base64 encodes every 3 bytes of input as 4 ASCII characters. That's a 4/3 ratio, which means about 33% overhead. This is the unavoidable cost of encoding binary data into a text-only format.
Can I encode binary files like images or PDFs?+
Yes. Click the 'file' button next to the toolbar to upload any file. The tool reads the bytes locally and produces a Base64 string. This works for images, PDFs, ZIP archives, anything. The file never leaves your browser.
Why am I getting an 'invalid Base64 input' error?+
Common causes: characters that aren't part of the Base64 alphabet (only A-Z, a-z, 0-9, +, /, =, or -, _ for URL-safe), missing padding (= signs at the end of standard Base64), or whitespace mixed into the data. The tool tries to be lenient but malformed input will be rejected.
Is Base64 a form of encryption?+
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly — including this tool. Never use Base64 to 'hide' sensitive data. Use real encryption (AES, etc.) for that.
When should I use Base64 in real-world projects?+
Embedding small images directly in HTML or CSS via data URIs, transmitting binary content in JSON APIs (where raw bytes aren't allowed), encoding parts of a JWT, including binary attachments in MIME emails, or encoding credentials in HTTP Basic Auth headers.