Free Base64 Encoder & Decoder — Text, Files & Data URIs
Encode text or files to Base64, decode Base64 strings, and generate data URIs for HTML/CSS embedding. Instant results, no upload.
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data (bytes) into a string of 64 printable ASCII characters. The 64 characters are: A–Z (26), a–z (26), 0–9 (10), + and / (2), with = used as padding.
The name "Base64" comes from the fact that it uses 64 distinct characters to represent data.
How it works: Binary data is read in groups of 3 bytes (24 bits). Each 24-bit group is split into four 6-bit values. Each 6-bit value maps to one of the 64 characters in the Base64 alphabet.
- Text:
Hi! - ASCII bytes:
72 105 33 - Binary:
01001000 01101001 00100001 - 6-bit groups:
010010 000110 100100 100001 - Base64 chars:
S G k h - Base64 output:
SGkh
Base64 increases data size by ~33% (every 3 bytes becomes 4 characters).
When Is Base64 Used?
- Embedding images in HTML/CSS —
src="data:image/png;base64,iVBORw0..."embeds the image directly in the HTML without a separate HTTP request. Useful for small icons or critical above-the-fold images. - JWT tokens — JSON Web Tokens use Base64URL (a variant of Base64) to encode the header and payload sections. When you decode a JWT, you're doing Base64URL decoding.
- Email attachments — SMTP (email protocol) is text-based. Attachments are Base64-encoded to safely transmit binary files over text channels.
- API authentication — HTTP Basic Auth sends credentials as
Authorization: Basic base64(username:password). - Storing binary data in JSON — since JSON doesn't support raw binary, images or files are often Base64-encoded before being stored in JSON fields.
- Data URIs — small files (icons, fonts) are Base64-encoded and embedded directly in CSS or HTML to reduce HTTP requests.
Base64 Is NOT Encryption
Base64 encoding is not encryption and provides zero security. Anyone can decode a Base64 string in seconds. Never use Base64 to "protect" sensitive data like passwords, API keys, or personal information.
| Feature | Base64 | Encryption (e.g., AES) |
|---|---|---|
| Purpose | Data encoding / transport | Data confidentiality |
| Reversible? | Yes — by anyone | Only with correct key |
| Security | None | Strong (with proper key) |
| Data size | +33% larger | Similar size |
| Use case | Embed images, JWT, email | Storing passwords, encryption at rest |
How to Encode & Decode Base64 Online
ToolsArena's Base64 tool handles both text and files:
- Text encoding — paste any text and get the Base64 encoded string instantly
- Text decoding — paste a Base64 string to see the original text
- File to Base64 — upload an image or file to get its Base64 data URI (useful for embedding in HTML/CSS)
- Base64 to file — paste a Base64 data URI to download the original file
Standard Base64 uses + and / characters, which are not URL-safe. URLs use a variant called Base64URL that replaces + with - and / with _. JWTs use Base64URL. If you're decoding a JWT token, use the Base64URL mode.
How to Use the Tool (Step by Step)
- 1
Open the Base64 Encoder/Decoder
Go to ToolsArena Base64 Encode & Decode — no login needed.
- 2
Choose Encode or Decode mode
Select "Encode" to convert text/file to Base64, or "Decode" to convert Base64 back to text/file.
- 3
Paste text or upload file
For encoding: type or paste your text, or upload a file. For decoding: paste the Base64 string.
- 4
Get the result
The encoded or decoded output appears instantly as you type.
- 5
Copy or download
Copy the result to clipboard or download as a file.
Frequently Asked Questions
How do I decode a Base64 string online?+−
Paste the Base64 string into ToolsArena's Base64 Decode tool and switch to "Decode" mode. The original text or file appears instantly. You can also decode in the browser console with: atob("your-base64-string").
How do I encode a file to Base64 for use in HTML?+−
Upload your image or file to the Base64 Encoder tool and copy the "data URI" output (e.g., data:image/png;base64,iVBOR...). Paste this directly as the src attribute of an img tag. Note: Base64-encoded images load slightly faster (no extra HTTP request) but increase HTML file size by 33%.
How do I decode a JWT token?+−
A JWT has three parts separated by dots: header.payload.signature. The header and payload are Base64URL encoded. Paste each part (separately) into the Base64 decoder in URL-safe mode to read the content. ToolsArena also has a dedicated JWT Decoder tool that splits and decodes all three parts automatically.
What is the difference between Base64 and Base64URL?+−
Standard Base64 uses the characters +, /, and = (for padding). These characters have special meaning in URLs. Base64URL is a variant that uses - instead of +, _ instead of /, and optionally omits padding (=). JWTs, OAuth tokens, and some APIs use Base64URL to ensure the encoded string is safe in URLs and HTTP headers.
Why does my Base64 decoded output look like garbage?+−
This happens when: (1) the Base64 string encodes binary data (like an image) not text — download it as a file instead of viewing as text; (2) the Base64 string is corrupted or incomplete — ensure you copied the complete string; (3) the encoding is Base64URL and you used standard decoder — switch to URL-safe mode.
Free Base64 Encoder & Decoder — Text, Files & Data URIs
Encode text or files to Base64, decode Base64 strings, and generate data URIs for HTML/CSS embedding. Instant results, no upload.
Encode / Decode Base64Related Guides
JSON Formatter Guide
A complete developer reference for JSON syntax, common errors, formatting options, and how to validate JSON in any language or tool.
Strong Password Guide
NIST 2024 guidelines, time-to-crack tables, and the right way to manage passwords.
URL Encode & Decode — What It Is, How It Works & When to Use It
Developer guide to URL encoding: percent-encoding, query strings, and common pitfalls