Base64 Encode / Decode

Client-side only

Encode text to Base64 or decode Base64 to text instantly. Supports standard and URL-safe Base64. All processing happens in your browser.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It was designed to safely transmit binary data over text-based protocols that might corrupt raw binary bytes.

Base64 encodes every 3 bytes of input into 4 characters, increasing the data size by roughly 33%. The output uses only safe characters, making it ideal for embedding images in HTML, encoding file attachments in emails, and passing binary data in JSON or HTTP headers.

Base64 is not encryption — it is purely an encoding scheme. Anyone can decode Base64 instantly. Do not use it to hide sensitive data. URL-safe Base64 replaces + with - and / with _, making it safe to include in URLs without percent-encoding.

How to Use This Tool

  1. Choose Encode or Decode mode using the toggle buttons at the top.
  2. Type or paste your text into the left input field.
  3. The result appears instantly in the right output field.
  4. Use the URL-safe toggle if you need output safe for use in URLs or filenames (replaces + with - and / with _).
  5. Click Copy to copy the result to your clipboard.

Common Use Cases

Encoding Images for HTML/CSS

Embed small images directly in HTML or CSS as data URIs to reduce HTTP requests.

Email Attachments

MIME email encoding uses Base64 to attach binary files (PDFs, images) in plain-text email formats.

API Credentials

HTTP Basic Authentication sends credentials as Base64-encoded username:password in the Authorization header.

JWT Tokens

Each section of a JWT (header, payload) is Base64URL-encoded. Decode them to inspect the contents.

Storing Binary Data in JSON

JSON doesn't support raw binary, so binary blobs (images, files) are Base64-encoded before being stored in JSON.

URL-Safe Data Transfer

URL-safe Base64 lets you pass binary data in query strings and path segments without percent-encoding issues.

Frequently Asked Questions

Is Base64 the same as encryption?

No. Base64 is an encoding scheme, not encryption. It is trivially reversible by anyone — it provides no security. Use AES or RSA encryption if you need to protect data.

What is URL-safe Base64?

Standard Base64 uses + and / characters that have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, making the output safe to include in URLs without percent-encoding. It is used in JWTs and OAuth tokens.

Why does Base64 output end with == or =?

Base64 encodes 3 bytes into 4 characters. When the input length is not a multiple of 3, padding characters (=) are added to make the output length a multiple of 4. One = means 1 padding byte, == means 2.

How much larger is Base64 output vs the original?

Base64 increases data size by approximately 33%. Every 3 bytes of input become 4 characters of output. A 1 MB file becomes roughly 1.37 MB when Base64-encoded.

Can I use Base64 to encode binary files?

Yes, but this tool is text-based and works with UTF-8 strings. For encoding actual binary files (images, PDFs), you would typically use a library like btoa() in JavaScript or base64 command-line tool.

Want to learn more? Read our guide: Base64 Encoding Explained with Examples

Read →