🔐 Base64 Encode & Decode
Encode text to Base64 or decode Base64 back to text. Runs entirely in your browser.
What is Base64 Encoding and Why Do Developers Use It?
Base64 is a binary-to-text encoding scheme that converts binary data into a safe ASCII string format. It's one of the most commonly used encoding methods in web development, APIs, and data transmission. The name "Base64" comes from the 64 printable characters used in the encoding alphabet: A-Z, a-z, 0-9, +, and /.
Common Use Cases for Base64 Encoding in Web Development
- Embedding images in HTML and CSS — Convert small icons and logos into Base64 data URIs to reduce HTTP requests and speed up page loading
- Sending binary data in JSON API payloads — JSON doesn't support binary, so files and images are Base64-encoded before transmission
- Email attachments (MIME encoding) — SMTP only supports ASCII, so email attachments are Base64-encoded
- Storing binary data in text-only databases — Some systems only accept string values; Base64 lets you store binary data safely
- Basic HTTP Authentication headers — The
Authorization: Basicheader uses Base64 to encodeusername:passwordpairs - Data URIs in web applications — Embed fonts, SVGs, and small images directly in stylesheets without extra file requests
How Base64 Encoding Works
Base64 takes every 3 bytes (24 bits) of input data and splits them into 4 groups of 6 bits each. Each 6-bit value maps to one of 64 printable ASCII characters. If the input length isn't a multiple of 3, padding characters (=) are added to the output. This process increases the data size by approximately 33%, which is why Base64 should only be used when text-safe encoding is required — not for general compression.
Base64 Encoding vs URL-Safe Base64
Standard Base64 uses + and / characters, which have special meaning in URLs and filenames. URL-safe Base64 (used in JWTs) replaces these with - and _ to avoid conflicts. This tool uses standard Base64 encoding (btoa()/atob() functions).
How to Use This Free Online Base64 Converter
Select Encode or Decode mode, paste your text (or upload a file up to 5 MB), and click the button or press Ctrl+Enter. Use the Swap button to quickly move output back to input for round-trip testing. All processing happens in your browser — no data is transmitted to any server.