Base64 Encode/Decode
Encode or decode text using Base64 encoding.
Max 5 MB
Enter input above. With Auto-run on, output updates as you type.
What is Base64?
Base64 is an encoding scheme that converts binary data into a text string using 64 printable ASCII characters (A–Z, a–z, 0–9, plus + and /, with = for padding). It does not encrypt or compress data—anyone can decode it. It is used wherever binary data must be represented as text.
Common uses include embedding images or files in HTML/CSS (data URLs), sending binary content in email (MIME), storing secrets in config files (note: Base64 is not encryption—use proper secrets management), and API authentication (e.g. HTTP Basic). Encoding typically increases size by about one-third.
Common uses:
- API auth — HTTP Basic Auth and some tokens use Base64-encoded credentials.
- Email / MIME — Attachments and binary content in email are often Base64-encoded.
- Data URLs — Embed small images or files in HTML/CSS as
data:.... - Config / secrets — Some configs store values in Base64 (not encryption—decode reveals the value).
Base64 FAQ
Is Base64 encryption?
No. Base64 is encoding, not encryption. It converts binary data to text so it can be sent or stored in text-only contexts. Anyone can decode it without a key. For secrets, use proper encryption and key management.
Why does Base64 end with '='?
The = characters are padding. Base64 encodes in 24-bit (3-byte) groups into 4 characters. If the input length is not a multiple of 3, padding is added so the output length is a multiple of 4. The = signs indicate how many padding bytes were added.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces them with - and _ so the string can be used in query parameters or paths without escaping. Padding can also be omitted in some contexts.
Why does decode fail?
Decode can fail if the input contains invalid characters (only A–Z, a–z, 0–9, +, /, and = are valid), has the wrong length (after trimming, length should allow valid padding), or has incorrect padding. Whitespace and newlines are trimmed automatically. Enable URL-safe if your string uses - and _.
How do I encode a file?
Click "Upload file", choose your file (max 5 MB), and ensure "Encode" is selected. The tool will read the file and show the Base64 string in the output, plus file name, size, and type. You can copy the output or download it as a .txt file.