Base64 Forge

Encode & Decode Base64 Instantly

Convert text to Base64 and back. Upload files to generate Base64 Data URIs. 100% free and private.

About This Tool

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, and /). It was originally designed to safely transport binary data through text-only channels like email (MIME), which could corrupt raw binary bytes. Today, Base64 is widely used for embedding images in CSS and HTML via data URLs, encoding authentication credentials in HTTP headers (Basic Auth), storing binary blobs in JSON payloads, and transmitting data through systems that only support text.

The encoding process works by taking every 3 bytes (24 bits) of input and splitting them into 4 groups of 6 bits, each mapped to one of the 64 characters in the Base64 alphabet. Because 3 bytes become 4 characters, Base64 encoding always increases data size by approximately 33%. This overhead is the primary tradeoff — you gain universal text compatibility at the cost of larger payloads. For small assets like icons or simple SVGs, the overhead is negligible and eliminates an extra HTTP request. For large files, the size increase makes Base64 impractical compared to direct binary transfer.

Browsers provide btoa() and atob() functions for Base64 encoding and decoding, but these only work with Latin-1 characters. To handle UTF-8 text (which includes characters like emoji, CJK characters, and accented letters), this tool uses TextEncoder and TextDecoder to properly convert between UTF-8 byte sequences and Base64. The URL-safe variant replaces + with -, / with _, and strips trailing = padding — this is essential when Base64 strings appear in URLs or filenames where those characters have special meaning.

The file-to-Base64 feature reads any file as a data URL (data:[mimetype];base64,...), which you can paste directly into HTML img src attributes, CSS background-image declarations, or JSON payloads. This is commonly used for embedding small images in email templates (where external image loading is often blocked), inlining critical assets in single-page applications, and storing file uploads in document databases. For larger files, consider alternatives like multipart form uploads or direct binary protocols (WebSocket, gRPC) that avoid the 33% size overhead entirely.

File to Base64

Upload any file to convert it to a Base64 Data URI. Useful for embedding images in HTML/CSS.

Learn More

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 was designed to safely transmit binary data through text-based protocols like email (MIME) and HTTP. The encoding process takes every 3 bytes of input and converts them into 4 Base64 characters, resulting in approximately 33% size increase. Base64 is not encryption — it's a reversible encoding that provides no security. It's used to embed binary content (images, files) directly in text formats like HTML, CSS, JSON, and XML.

Developers frequently use Base64 for data URIs that embed small images directly in HTML or CSS, eliminating additional HTTP requests. It's essential for encoding file attachments in email (MIME), transmitting binary data in JSON APIs, and storing binary content in text-based databases or configuration files. Base64 is also used in authentication headers (HTTP Basic Auth), JWT tokens, and data transfer between systems with different character encoding requirements.

Only embed small assets (under 10KB) as Base64 data URIs — larger files are better served as separate requests due to the 33% size overhead and inability to be cached independently. Use URL-safe Base64 (replacing + with - and / with _) for data that appears in URLs or filenames. When decoding Base64 from untrusted sources, always validate the output before processing. For large files, consider streaming encoding/decoding to avoid memory issues.

How to Encode & Decode Base64

1

1. Choose Mode

Select Encode or Decode mode. Use Encode to convert text to Base64, or Decode to convert Base64 back to readable text.

2

2. Enter Your Data

Type or paste your text/Base64 string. The conversion happens in real-time as you type. Toggle URL-safe mode for URL-friendly output.

3

3. Copy the Result

Copy the output with one click. For files, use the File to Base64 section to get a complete Data URI ready for HTML or CSS.

Frequently Asked Questions

Is this Base64 encoder free?

Yes, 100% free with no limits. Encode and decode as much as you need without registration.

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that converts data into ASCII characters. It's used to embed images in HTML, send data in APIs/emails, and handle binary data in text-only environments.

Is my data safe?

Absolutely. Everything runs in your browser using JavaScript's built-in btoa/atob. No data is sent to any server.

Can I convert files to Base64?

Yes! Upload any file to get its Base64 Data URI. This is perfect for embedding images directly in HTML or CSS.

Explore More Tools