Free Base64 Encoder & Decoder
Encode text or files to Base64 and decode Base64 strings back to readable format — instantly, in your browser. No signup, no data stored.
What is Base64 Encoding?
Base64 is an encoding scheme that converts binary data into a plain ASCII text format using 64 printable characters (A–Z, a–z, 0–9, +, /). It is widely used to safely transmit binary data over text-based protocols like HTTP, email (SMTP), and JSON APIs.
Our free Base64 tool lets you instantly encode any text or file to Base64, or decode any Base64 string back to its original form — all without leaving your browser. Nothing is sent to any server.
Common use cases include embedding images directly in HTML/CSS as data URIs, encoding binary attachments in emails, storing binary data in JSON payloads, and passing binary values in URL query parameters.
64
Characters used
A–Z, a–z, 0–9, +, /
+33%
Size increase
Base64 output is ~33% larger than input
1987
Year invented
First defined in RFC 989 for email
< 1ms
Conversion speed
Instant in-browser processing
How to encode or decode Base64?
Convert text or files to Base64 in seconds — no setup needed.
Choose Mode
Select "Encode" to convert text to Base64, "Decode" to convert Base64 back to text, or "File → Base64" to encode any file.
Enter Input
Type or paste your text in the input box, or drag and drop a file. Input is processed instantly.
Get Output
The result appears instantly in the output box — Base64 encoded string or decoded original text.
Copy or Download
Copy the result to your clipboard with one click, or download the output as a text file.
Everything in one Base64 tool
Encode, decode, validate, and convert — all from one clean interface.
Instant Conversion
Real-time encoding and decoding as you type — no button clicks needed.
File to Base64
Convert any file — image, PDF, audio — to a Base64 string in one click.
100% Private
All conversion happens in your browser. No data leaves your device.
Input Validation
Automatically detects invalid Base64 and shows a clear error message.
One-Click Copy
Copy the output to clipboard instantly — ready to paste anywhere.
Swap Input/Output
Swap encoded and decoded content with one click for quick round-trips.
Mobile Friendly
Works perfectly on all screen sizes — desktop, tablet, and smartphone.
No Size Limits
Convert large texts and files without any size restrictions.
When do you need Base64?
Base64 is everywhere in web development, APIs, email, and security.
Web Developers
Embed images as data URIs in HTML/CSS to eliminate extra HTTP requests.
API Integration
Encode binary data for safe transmission in JSON payloads and HTTP headers.
Email Attachments
SMTP encodes all email attachments in Base64 for safe text-based transport.
Authentication
Basic Auth headers use Base64 encoding: "username:password" → Base64.
Data Storage
Store binary content like images in databases as Base64 text strings.
Debugging & Testing
Inspect and decode Base64 encoded values in JWT tokens, cookies, or API responses.
Get more out of Base64 Converter
These tips will save you time when working with Base64.
Data URI for images
Prefix image Base64 with "data:image/png;base64," to use it directly in <img src="..."> tags.
Decode JWT tokens
JWT payloads are Base64-encoded. Paste the middle part (between dots) to decode and inspect claims.
Check email MIME parts
Raw email source contains Base64-encoded attachments. Decode them here to inspect the content.
URL-safe Base64
Standard Base64 uses + and / which need URL encoding. Replace them with - and _ for URL-safe Base64.
Round-trip test
Encode a string, then immediately decode the result — the output should match your original input exactly.
Embed fonts in CSS
Base64 encode .woff or .ttf files and embed them directly in your CSS to avoid external font requests.
Base64 ≠ Encryption
Base64 is encoding, not encryption. Anyone can decode it. Never use it to "hide" sensitive data.
Padding matters
Valid Base64 strings always have a length divisible by 4. Missing = padding can cause decode errors.
Is this tool 100% safe to use?
Yes — completely safe. Your data is never sent to our servers. All encoding and decoding happens locally in your browser using JavaScript.
- All conversion happens locally in your browser
- Your text and files are never sent to any server
- No cookies, no tracking, no account required
- Works offline once the page is loaded
- Base64 is NOT encryption — data can be decoded by anyone
- Never use Base64 to hide sensitive/secret information
Technical Details
btoa() / atob()
Built-in APIJavaScript's built-in btoa() encodes text to Base64 and atob() decodes Base64 back to text.
FileReader API
File SupportFiles are processed using FileReader.readAsDataURL() — no server upload, no network requests.
UTF-8 Support
UnicodeUnicode text (Hindi, Arabic, Chinese, emoji) is handled using encodeURIComponent wrapper for correct encoding.
Base64 Encoding: Complete Guide
How does Base64 work?
Base64 takes every 3 bytes of input (24 bits) and splits them into four 6-bit groups. Each group maps to one of 64 printable ASCII characters. The result is always 33% larger than the original data, with = padding added to make the length a multiple of 4.
Why was Base64 invented?
Early internet protocols like SMTP were designed to handle only 7-bit ASCII text. Sending binary data (like images) over these systems would corrupt the data. Base64 was invented to encode binary into plain text, allowing safe transmission over any text-based system.
Base64 in JavaScript
JavaScript has built-in functions: btoa() encodes a string to Base64, atob() decodes Base64 back to a string. For binary files, use FileReader with readAsDataURL() to get a Base64 data URI. Our tool uses these same browser APIs.
URL-safe Base64
Standard Base64 uses + and / which are special characters in URLs. URL-safe Base64 replaces + with - and / with _ to avoid URL encoding issues. This variant is commonly used in JWT tokens and OAuth flows.
Base64 vs Base64URL vs Base32
Base64: standard, uses +/. Base64URL: URL-safe, uses -_. Base32: uses A-Z and 2-7, produces longer output but is case-insensitive and human-readable. Base64 is the most compact and widely used for web and API applications.
Is Base64 secure?
No. Base64 is an encoding scheme, not encryption. Anyone can decode it instantly. Never use Base64 to protect passwords or sensitive information. For security, use proper encryption (AES, RSA) or hashing (bcrypt, SHA-256) instead.
Frequently Asked Questions
Everything you need to know about Base64 encoding and decoding.