What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a string
of printable ASCII characters. It works by grouping every 3 bytes of input
into 4 characters chosen from a 64-character alphabet (A–Z, a–z, 0–9, +, /),
with = used as padding.
Because many protocols — such as HTTP, email (SMTP/MIME), and JSON — were designed to handle text, Base64 provides a reliable way to embed binary data like images, fonts, and files inside text-based formats without data corruption.
How to Use This Base64 Tool
Choose a Tab
Select Text, Image, File, or JWT depending on what you want to convert.
Enter Input
Type, paste, or drag & drop your content into the input area.
Encode or Decode
Click Encode or Decode. The result appears instantly in the output field.
Copy or Download
Copy the result to clipboard or download the decoded file directly.
Features
- Text Tab — Encode any text (including Unicode, emojis, and multi-language characters) to Base64, or decode Base64 back to readable text. Live character and byte counters show the size difference.
- URL-safe Base64 — Replaces
+with-and/with_for safe use in URLs and JWT tokens. - MIME formatting — Wraps output at 76 characters per line, as required by email standards (RFC 2045).
- Image Tab — Convert PNG, JPG, GIF, WebP, and SVG images to Base64 Data URLs. Copy as a raw string, an HTML
<img>tag, or a CSSbackground-imagevalue. Also decodes Base64 back to a downloadable image. - File Tab — Encode any file type (PDF, ZIP, font, video, etc.) to Base64, or paste a Data URL to download the original file. Supports drag & drop.
- JWT Tab — Paste any JSON Web Token to instantly decode the Header and Payload as formatted JSON, and check whether the token has expired.
- Validate — Check whether a string is valid Base64 before decoding.
- 100% client-side — All processing happens in your browser. No files or data are uploaded to any server.
Common Use Cases
Embed Images in CSS / HTML
Convert icons or small images to Base64 Data URLs and embed them directly in stylesheets or HTML, eliminating extra HTTP requests.
Email Attachments (MIME)
Email protocols use Base64 to encode binary attachments so they can travel through text-based SMTP servers without corruption.
JWT & API Tokens
JSON Web Tokens use URL-safe Base64 encoding for their Header and Payload segments. Decode them to inspect claims and expiry.
Encode Files for APIs
Many REST APIs accept file uploads as Base64-encoded strings in JSON payloads, such as PDFs, certificates, or audio files.
Embed Fonts in CSS
Use Base64 to inline web fonts inside a stylesheet with @font-face so pages render correctly even without network access.
Store Binary in JSON / XML
Databases and APIs that only support text fields use Base64 to safely store images, icons, and binary certificates.
Base64 Encoding Variants Explained
Standard Base64
Uses the full alphabet: A-Z a-z 0-9 + /, with = padding to make the output length a multiple of 4. This is the most common form, used in MIME email and data URLs.
URL-safe Base64
Replaces + with - and / with _ so the string can be used directly in URLs without percent-encoding. Used by JWTs (RFC 4648 §5).
MIME Base64 (76-char lines)
Inserts a newline (\r\n) every 76 characters as required by RFC 2045 for email body encoding. Use the "MIME lines (76)" checkbox when encoding for email.
Unpadded Base64
Strips the trailing = padding characters. Some APIs and JWT implementations use this to keep the token shorter.
Frequently Asked Questions
= padding characters are appended to make the output length a multiple of 4 characters.
TextEncoder API to first convert your text to UTF-8 bytes before applying Base64 encoding, so all Unicode characters — including emojis, Arabic, Chinese, and Hindi — are handled correctly.
<img src="data:image/png;base64,..."> tag ready to paste directly into any HTML file.