🔐 Base64 is NOT encryption. Attackers exploit this misconception — credentials encoded in Base64 are instantly readable. Use it for data transport, never for security. All processing happens in your browser. Why encoding ≠ encrypting →

Base64 Encoder & Decoder

Encode and decode Base64 strings instantly. Supports file upload, image preview, and URL-safe mode — all in your browser.

Text Input
0 characters
Base64 Output
0 characters
Drop file to encode
Base64 Quick Reference
Character Set
A-Z, a-z, 0-9 + / (standard) - _ (URL-safe)
Padding
= padding character Output always 4n length Omitted in URL-safe
Size Overhead
3 bytes → 4 characters ~33% size increase Constant ratio
Common Uses
Data URIs (images) Email attachments JWT tokens
JavaScript API
btoa() — encode atob() — decode TextEncoder for UTF-8
Data URI Format
data:[mime];base64,... Embed in img src Embed in CSS url()

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme defined in RFC 4648. It converts binary data into a sequence of 64 printable ASCII characters — letters (A–Z, a–z), digits (0–9), plus (+), and slash (/) — with equals (=) for padding. This makes it safe to transmit binary data through text-only channels like email (MIME), JSON payloads, URLs, and XML documents.

When to Use Base64

  • Data URIs: Embed images, fonts, or other assets directly in HTML or CSS without additional HTTP requests.
  • Email attachments: MIME encoding uses Base64 to attach binary files to email messages.
  • JWT tokens: JSON Web Tokens use URL-safe Base64 to encode the header and payload segments.
  • API payloads: Safely include binary data (images, PDFs, certificates) inside JSON or XML API requests.
  • Basic auth: HTTP Basic Authentication encodes credentials as a Base64 string in the Authorization header.

Standard vs URL-safe Base64

Feature Standard Base64 URL-safe Base64
AlphabetA–Z, a–z, 0–9, +, /A–Z, a–z, 0–9, -, _
Padding= (required)Omitted
RFCRFC 4648 §4RFC 4648 §5
Use caseMIME, data URIs, PEMURLs, JWT, filenames
Size ratio4:3 (33% overhead)4:3 (33% overhead)

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses 64 printable characters (A–Z, a–z, 0–9, +, /) to encode every 3 bytes of input into 4 characters of output, with = padding. It's commonly used to embed images in HTML/CSS, transmit binary data in JSON or XML, and encode email attachments via MIME.

How do I encode text to Base64?

Paste or type your text into the input panel on the left with Encode mode selected. The Base64-encoded output appears instantly on the right. You can also drag and drop a file onto the input area to encode its binary contents to a Base64 string.

How do I decode Base64 back to text?

Switch to Decode mode using the toggle at the top, then paste your Base64 string into the input panel. The decoded plain text appears on the right in real time. If the decoded data is an image, a preview is shown below the output.

What is URL-safe Base64?

URL-safe Base64 replaces the + and / characters with - and _ respectively, and removes = padding. This makes the encoded string safe for use in URLs, query parameters, and filenames without additional percent-encoding. It's defined in RFC 4648 Section 5.

Can I encode files and images to Base64?

Yes. Drag and drop any file onto the input area or use the file upload button. The tool reads the file in your browser and converts its binary content to a Base64 string. This is useful for embedding images as data URIs in HTML or CSS.

Is my data safe when using this tool?

Yes. All encoding and decoding happens entirely in your browser using JavaScript. No data is sent to any server. Your text, files, and Base64 strings never leave your device.

Why does Base64 increase the size of data?

Base64 encodes every 3 bytes of input into 4 ASCII characters, resulting in roughly a 33% size increase. This overhead is the trade-off for being able to safely transmit binary data through text-only channels like email, JSON, and URLs.

Related Tools