ToolBox.Online

Base64 Encode and Decode - Free Online Base64 Converter

Encode text to Base64 or decode Base64 to text instantly. Free online Base64 converter tool. No signup, no data sent to server.

What is Base64 Encode/Decode?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses a set of 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding to encode any binary data into a printable text format. Base64 encoding is essential in computing because many systems (email, URLs, JSON, XML) can only safely handle text data. By encoding binary data (images, files, cryptographic keys) into Base64, you can embed them in text-only contexts without corruption. The encoding increases data size by approximately 33% (every 3 bytes become 4 Base64 characters), which is a small tradeoff for universal text compatibility. Base64 is not encryption — it is easily reversible and provides no security.

How to Use Base64 Encode/Decode

Paste your text into the input field and click "Encode" to convert it to Base64, or paste a Base64 string and click "Decode" to convert it back to plain text. The result appears instantly in the output field. Click "Copy" to copy the result to your clipboard. You can also swap input and output with the swap button for quick back-and-forth conversion.

How Base64 Encode/Decode Works

Base64 encoding works by converting every 3 bytes (24 bits) of input into 4 Base64 characters (6 bits each): 1. Take 3 input bytes (24 bits total) 2. Split into 4 groups of 6 bits each 3. Map each 6-bit value (0-63) to a character in the Base64 alphabet: • 0-25 → A-Z • 26-51 → a-z • 52-61 → 0-9 • 62 → + • 63 → / 4. If the input length is not divisible by 3, pad the output with = characters Decoding reverses this process: each Base64 character is mapped back to its 6-bit value, groups of 4 characters are combined into 3 bytes, and padding is removed.

Common Use Cases

  • Embedding images in HTML/CSS using data URIs (data:image/png;base64,...)
  • Encoding binary attachments in email (MIME) and JSON API payloads
  • Storing binary data in text-only formats like XML, JSON, or CSV
  • Encoding authentication credentials for HTTP Basic Authentication headers
  • Transferring binary data through systems that only support text (chat, SMS, URLs)
  • Encoding cryptographic keys and certificates (PEM format uses Base64)

Frequently Asked Questions

What is Base64 encoding used for?

Base64 encoding is used to represent binary data as text. Common uses include embedding images in HTML/CSS, encoding email attachments (MIME), storing binary data in JSON/XML, and encoding HTTP authentication credentials. It ensures binary data can pass through text-only systems without corruption.

Is Base64 encoding the same as encryption?

No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string back to its original form without any key or password. It provides no security or confidentiality — it simply converts binary to text format. Never use Base64 to protect sensitive data.

Why does Base64 make data larger?

Base64 increases data size by approximately 33%. Every 3 bytes of input become 4 Base64 characters (plus possible padding). This is because Base64 uses only 64 characters (6 bits each) to represent 8-bit bytes, so 3 bytes (24 bits) require 4 characters (24 bits) to encode.

What characters are used in Base64?

Standard Base64 uses 64 characters: uppercase A-Z (26), lowercase a-z (26), digits 0-9 (10), plus sign (+), and forward slash (/). The equals sign (=) is used for padding. URL-safe Base64 replaces + with - and / with _ to avoid URL encoding issues.

Can I Base64 encode files and images?

Yes. Any file (image, PDF, audio, etc.) can be Base64 encoded because Base64 works on raw bytes. This tool handles text encoding/decoding. For file encoding, you would read the file as bytes first, then encode those bytes — commonly done in programming languages or specialized tools.

Is my data safe with this tool?

Yes. All encoding and decoding happens entirely in your browser using JavaScript. Your data is never sent to any server. You can verify this by disconnecting from the internet and using the tool offline — it will still work perfectly.

Related Tools