🔐

Base64 Encoder / Decoder

Encode any text to Base64 (standard, URL-safe, or MIME) or decode any Base64 string back to plain text. Instant, free, no sign-up required.

Base64 Variant

Input

Output

Explore This Tool in Context

Base64 Encoder / Decoder is part of the Developer collection. If you want a broader view of similar workflows, open the Developer category page or browse all QuickTools categories.

Common next steps after this tool include JSON Formatter, QR Code Generator and UUID Generator.

What Is Base64?

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, +, /) plus the = padding character. Originally defined in RFC 2045 for MIME email attachments, it is now used everywhere binary or arbitrary byte data needs to travel safely through text-only channels—HTTP headers, JSON payloads, HTML data URIs, JWTs, and more.

Base64 is not encryption. It is purely an encoding: any computer can decode Base64 without a key. It increases size by roughly 33 % but ensures that characters like null bytes, control codes, and high-byte values are never misinterpreted by text-based protocols.

How to Use This Tool

  1. Paste plain text (or a Base64 string) into the Input box.
  2. Choose a variant: Standard, URL-safe, or MIME.
  3. Click Encode → to convert text → Base64, or ← Decode to do the reverse.
  4. Copy the result with one click, swap it back as input with ⇄ Use as Input, or download it as a .txt file.

Base64 Variants Explained

VariantStandard (RFC 4648 §4)URL-safe (RFC 4648 §5)MIME (RFC 2045)
CharactersA–Z a–z 0–9 + /A–Z a–z 0–9 − _A–Z a–z 0–9 + /
Padding= (required)None= (required)
Line breaksNoneNoneCRLF every 76 chars
Use caseGeneral encodingJWTs, URLs, cookiesEmail (MIME) attachments

Real-World Examples

HTTP Basic Authentication

Authorization: Basic dXNlcjpwYXNzd29yZA==

The credential "user:password" encoded as standard Base64.

JWT Header

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

URL-safe Base64 (no padding) encoding {"alg":"HS256","typ":"JWT"}.

HTML Inline Image (data URI)

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

Standard Base64 embeds binary image data directly in HTML.

MIME Email Attachment

Content-Transfer-Encoding: base64
VGhpcyBpcyBhIHRlc3Q=

MIME Base64 breaks output into 76-char CRLF-delimited lines.

How Base64 Encoding Works

Base64 encodes 3 bytes (24 bits) of input as 4 output characters (6 bits each). The 6-bit index into the character table ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ determines each character. When the input length is not a multiple of 3, one or two = padding characters are appended so the output length is always a multiple of 4.

Example: the 3-byte string Man (0x4D 0x61 0x6E) becomes six 6-bit groups 010011 010110 000101 101110, mapping to TWFu. The ≈33 % size overhead (3 bytes → 4 chars) is the inherent cost of Base64 encoding.

Frequently Asked Questions

Is Base64 the same as encryption?

No. Base64 is an encoding — it has no key and anyone can reverse it. It prevents data corruption in text channels, not unauthorised access. For confidentiality, use AES-256 or TLS.

When should I use URL-safe Base64?

Whenever the encoded string will appear in a URL, query parameter, cookie, or JWT. Standard Base64 uses + and / which are reserved URL characters; URL-safe replaces them with - and _ and removes = padding, making the string safe without percent-encoding.

What is MIME Base64 and when do I need it?

MIME Base64 (RFC 2045) is identical to standard Base64 except the output is split into 76-character lines separated by CRLF ( ). It is required for email attachments and multipart MIME bodies where very long lines can confuse mail servers.

Why does the decoder say 'Invalid Base64'?

The input may contain characters outside the Base64 alphabet, incorrect padding (= count), or be a standard string being decoded as URL-safe (or vice versa). Try switching the variant selector or ensure the entire Base64 block is pasted with no extra spaces at line boundaries.

Can I Base64-encode binary files (images, PDFs)?

This tool works with text input only. For binary files, use a file-based encoder in your language runtime — for example Buffer.from(fileBytes).toString('base64') in Node.js or base64.b64encode(data) in Python.

Does Base64 compress data?

No, it expands it by about 33 %. Base64 is designed for safe transmission, not compression. If size matters, compress first (gzip / brotli) and then Base64-encode the compressed bytes.

Is my data sent to a server?

All encoding and decoding is performed server-side via an API call but nothing is stored or logged. For sensitive data you can run the tool offline or use the Node.js Buffer API locally.

Related Tools

More in Developer

View category hub →