Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
What is Base64 and when do you use it?
Base64 is an encoding scheme that represents binary data using only 64 printable ASCII characters. The name comes from the 64-character alphabet it uses: A–Z, a–z, 0–9, +, and /. It was designed for one purpose: safely transmitting data through channels that only support plain text.
Common real-world uses include embedding images directly in HTML or CSS (data:image/png;base64,…), encoding binary payloads in JSON APIs, storing small files in localStorage, and transmitting data in email (MIME encoding).
How to encode and decode
- To encode: paste your plain text into the input and click Encode →. The Base64 string appears in the output.
- To decode: paste the Base64 string into the input and click ← Decode. The original text appears in the output.
- Use Swap ⇅ to move the output back to the input for chaining operations.
Base64 vs URL-safe Base64
Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces them with - and _and omits padding. You'll encounter URL-safe Base64 in JWTs, OAuth tokens, and some API parameters. If you see - and _ instead of + and /, replace them before decoding with this tool.
Base64 in real-world development
Base64 appears in many standard protocols and APIs. JSON Web Tokens (JWTs) use Base64url encoding for all three sections: header, payload, and signature. HTTP Basic Authentication encodes credentials as Base64 in the Authorization: Basic header — for example, user:password becomes a Base64 string. Email attachments in MIME format are Base64-encoded so binary files (PDFs, images) survive text-only mail transport.
CSS and HTML embed small images as Base64 data URIs to eliminate HTTP requests:background-image: url("data:image/svg+xml;base64,ABC..."). REST APIs that accept file uploads via JSON body typically require the file content as a Base64 string. When debugging these protocols, pasting the Base64 string into this decoder instantly reveals the underlying content.
Performance considerations
Base64 encoding increases data size by approximately 33%. A 100 KB binary file becomes roughly 133 KB as Base64. For large files this overhead matters: it increases page weight, slows parsing, and prevents browser caching that normal file references benefit from. Reserve Base64 embedding for small assets (icons, simple SVGs, tiny images under 5–10 KB) where the saved HTTP request outweighs the size increase.
Frequently asked questions
- What is Base64 encoding?
- Base64 converts binary data (or any text) into a string of 64 safe ASCII characters (A–Z, a–z, 0–9, +, /). It's used to safely transmit data in contexts that only support text — like embedding images in HTML, sending binary data in JSON, or storing data in cookies.
- Is Base64 the same ?
- No. Base64 is encoding, not encryption. It's fully reversible by anyone who sees it — there's no key, no secret, no security. Never use Base64 to protect sensitive data. Use it only to encode data so it survives text-only transport.
- Does this tool support Unicode and emoji?
- Yes. The encoder uses encodeURIComponent + unescape internally to handle the full Unicode range before passing to btoa(), so characters like ₹, 中文, and emoji all encode and decode correctly.
- Is my data sent to a server?
- No. Encoding and decoding happen in your browser using JavaScript's built-in btoa() and atob() functions. Nothing is uploaded or logged.
- What's the = sign at the end of Base64?
- Base64 encodes 3 bytes at a time into 4 characters. If the input isn't a multiple of 3 bytes, padding characters (=) are added to make the output length a multiple of 4. One = means 1 padding byte; == means 2.
Related tools
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.
- Hash Generator
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes instantly.