You've probably seen strings like SGVsbG8gV29ybGQ= in API responses, email headers, or browser URLs. That's Base64. This guide explains what Base64 encoding is, why it exists, and how to encode and decode it instantly online.

⚡ Free Base64 Encoder / Decoder

Encode text, URLs, or images to Base64 — or decode any Base64 string. Instant, free, private.

Open Base64 Tool →

What Is Base64?

Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters. The 64 characters are:

The encoding works by taking every 3 bytes (24 bits) of input and splitting them into four 6-bit groups. Each 6-bit group maps to one of the 64 characters.

Why Is Base64 Used?

Some protocols (like email via SMTP, or certain HTTP headers) were designed to handle only text, not arbitrary binary data. Base64 solves this by representing any binary data as safe, printable text. Common use cases include:

1. Embedding images in HTML/CSS

Instead of referencing an image file, you can embed it directly using a Data URL:

<img src="data:image/png;base64,iVBORw0KGgo..." />

This reduces HTTP requests but increases file size. Use the Image to Base64 Converter for this.

2. API authentication

HTTP Basic Authentication encodes credentials as Base64:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Note: Base64 is not encryption. Anyone can decode it. Always use HTTPS.

3. Email attachments (MIME)

Email attachments are encoded in Base64 so binary files (PDFs, images) can travel through text-based email protocols.

4. JWT tokens

JSON Web Tokens use Base64URL (a URL-safe variant) to encode the header and payload. Use the JWT Decoder to inspect them.

5. Storing binary data in JSON or XML

Since JSON strings must be valid Unicode text, binary data (images, files) must be Base64-encoded before embedding.

Base64 Encoding Example

Let's encode the word "Hello":

Character ASCII (decimal) Binary (8-bit)
H7201001000
e10101100101
l10801101100
l10801101100
o11101101111

The 5 bytes (40 bits) are grouped into six 6-bit chunks, mapped to Base64 characters, and padded with = to make the output a multiple of 4: SGVsbG8=

How to Encode Base64 Online

  1. Go to the QuickTools Base64 Tool
  2. Select Encode mode
  3. Type or paste your text
  4. The Base64 output appears instantly
  5. Click Copy

How to Decode Base64 Online

  1. Go to the QuickTools Base64 Tool
  2. Select Decode mode
  3. Paste the Base64 string (e.g. SGVsbG8=)
  4. The decoded text appears instantly

If the Base64 string decodes to binary (not readable text), the tool will indicate that the output is binary data.

Base64 vs Base64URL

Standard Base64 uses + and /, which have special meaning in URLs. Base64URL replaces them with - and _, making encoded strings safe to use in URLs and filenames without percent-encoding.

Variant Special chars Use case
Base64+/=Email, general encoding
Base64URL-_ (no padding)JWT, URLs, filenames

Base64 in JavaScript

// Encode
const encoded = btoa("Hello World");
// → "SGVsbG8gV29ybGQ="

// Decode
const decoded = atob("SGVsbG8gV29ybGQ=");
// → "Hello World"

Note: btoa() only works with Latin-1 characters. For Unicode strings, encode to UTF-8 bytes first.

Base64 in Python

import base64

# Encode
encoded = base64.b64encode(b"Hello World").decode()
# → 'SGVsbG8gV29ybGQ='

# Decode
decoded = base64.b64decode("SGVsbG8gV29ybGQ=").decode()
# → 'Hello World'

Frequently Asked Questions

Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. Anyone can decode it — there's no secret key. Never use Base64 to hide sensitive data. Use proper encryption (AES, RSA) instead.
Why does Base64 output end with = or ==?
Base64 processes 3 bytes at a time. If the input isn't a multiple of 3 bytes, padding characters (=) are added to complete the last group.
How much does Base64 increase file size?
Approximately 33%. Every 3 bytes of input become 4 Base64 characters, increasing size by 4/3.
Can I encode images to Base64?
Yes. Use the Image to Base64 Converter to get a data URL you can embed directly in HTML or CSS.

Encode or decode Base64 now

Free, instant, and private — runs entirely in your browser.

Open Base64 Tool →