Skip to main content
🔢

Base64 Encoder / Decoder

Encode text, decode Base64, or convert files to Base64 data URLs.

Size: 0 B

Size: 0 B  |  Overhead:

How to Use Base64 Encoder/Decoder

  • Encode Text: Type or paste text on the left; Base64 output appears on the right.
  • Decode Text: Paste a Base64 string on the left; decoded text appears on the right.
  • File to Base64: Drop any file to get its Base64 data URL, along with HTML/CSS snippets.

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A–Z, a–z, 0–9, +, and /). It converts every 3 bytes of binary data into 4 printable ASCII characters, making it safe to transmit binary data over systems designed to handle text, such as email or HTTP headers. The "64" refers to the 64 printable characters used in the encoding alphabet.

All processing happens in your browser using built-in JavaScript APIs — your data is never uploaded to any server.

Common Use Cases

  • Embedding images in CSS/HTML: Inline small images as data URLs to reduce HTTP requests
  • API authentication headers: HTTP Basic Auth encodes credentials as Base64 in the Authorization header
  • Email attachments: MIME encoding uses Base64 to include binary files in email messages
  • JWT tokens: The header and payload of JSON Web Tokens are Base64url encoded
  • Storing binary data in JSON: Since JSON only supports text, binary data must be Base64-encoded first

FAQ

Is Base64 the same as encryption?

No. Base64 is an encoding scheme, not encryption. It is easily reversible by anyone — all you need is a Base64 decoder. It is used to safely represent binary data as text, not to keep data secret. Never use Base64 as a security measure; use proper encryption instead.

Why does Base64 output sometimes end with == or =?

Base64 works in 3-byte groups. If the input length is not divisible by 3, padding characters (=) are added to fill the last group. One = means one byte was left over; == means two bytes were left over. This padding ensures the encoded string has a length that is a multiple of 4.

How much larger is Base64 output compared to input?

Base64 encoding increases data size by approximately 33%. Every 3 bytes of input becomes 4 bytes of Base64 output. For example, a 1 MB file will become roughly 1.33 MB when Base64 encoded. This overhead is shown in the tool.

What is URL-safe Base64?

Standard Base64 uses + and / characters which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _, making the output safe to include in URLs and filenames without percent-encoding. JWT tokens use URL-safe Base64 (also called Base64url).

Can I Base64 encode files?

Yes. Use the "File to Base64" tab to upload any file. The tool reads it as a binary data URL in the format data:[type];base64,[data]. You can also get ready-to-use HTML img tag and CSS background-image snippets for image files.

Related Tools