Free Online Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 strings back to plain text instantly with this free online tool. Convert files and images to Base64 data URIs, toggle URL-safe mode, and preview embedded images. No signup, no data stored on servers — everything runs 100% in your browser.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to safely transmit binary data over channels designed for text, such as email (MIME), embedding images in HTML/CSS, and encoding data in URLs or API payloads.
Each group of 3 bytes is converted into 4 Base64 characters, resulting in an output roughly 33% larger than the original. Padding with = characters is added when the input length is not a multiple of 3.
Common Use Cases
- Embedding images in HTML/CSS — Convert images to Base64 data URIs to reduce HTTP requests
- Email attachments (MIME) — Encode binary files for safe transmission via SMTP
- API authentication — HTTP Basic Auth encodes credentials as Base64
- Data URIs — Embed small files directly in web pages or stylesheets
- JWT tokens — JSON Web Tokens use Base64url encoding for header and payload
- Storing binary in JSON/XML — Safely include binary data in text-based formats
Features
- Base64 Encode & Decode — Convert text to Base64 or decode Base64 to text with one click
- Auto-Detect — Automatically detects if your input is Base64-encoded and suggests the right action
- File to Base64 — Drag & drop or pick any file to convert it to a Base64 string
- Image Preview — If the Base64 string represents an image, see an instant preview
- URL-Safe Mode — Toggle URL-safe Base64 encoding (
+→-,/→_, no padding) - Swap Input/Output — Quickly swap fields for round-trip encoding and decoding
- Copy & Clear — One-click copy to clipboard and clear all fields
- Character Count — Live character and byte counts for both input and output
- Dark & Light Theme — Toggle between themes for comfortable use
- 100% Client-Side — Your data never leaves your browser
How to Use
- Paste text or a Base64 string into the input area
- Click Encode to convert text to Base64, or Decode to convert Base64 back to text
- Use File to Base64 to convert any file (images, PDFs, etc.) to a Base64 string
- Enable URL-safe mode for Base64 strings used in URLs or JWT tokens
- Click Copy to copy the output, or Swap to reverse the fields
Frequently Asked Questions
Is my data safe?
Yes. All encoding and decoding happens entirely in your browser using JavaScript's built-in btoa() and atob() functions. No data is sent to any server.
What is URL-safe Base64?
URL-safe Base64 replaces + with - and / with _, and removes padding = characters. This makes the encoded string safe to use in URLs, filenames, and JWT tokens without additional URL-encoding.
Can I encode files and images?
Yes. Click "File to Base64" or drag and drop any file onto the input area. The tool reads the file in your browser and converts it to a Base64 string. For images, you will also see a preview.
What is the maximum file size?
Since everything runs in your browser, the practical limit depends on your device's memory. Most modern browsers handle files up to 50-100 MB without issues. For very large files, consider a command-line tool.
Does this tool support Unicode?
Yes. The tool uses UTF-8 encoding before applying Base64, so it correctly handles all Unicode characters including emoji, CJK characters, and special symbols.
Need More Developer Tools?
Check out our full collection of free tools — JSON formatter, QR code generator, password generator, and more.
Browse All Tools