Skip to main content
ToolsHub

Base64 Encoder & Decoder

Instantly encode any text or file to Base64, or decode Base64 back to readable text. No data ever leaves your browser.

Updated

Files never leave your browser

All encoding and decoding happens in your browser.

How to use Base64 Encoder & Decoder

The Base64 Encoder / Decoder converts binary data or plain text to and from Base64 encoding — a scheme that represents arbitrary bytes using only 64 printable ASCII characters. It is widely used to embed images inline in CSS, transmit binary attachments over text-based protocols such as email (MIME) and JSON, and store compact binary data in cookies and JWTs.

  1. Choose the operation: Encode (text or file → Base64) or Decode (Base64 → text).
  2. For encoding, paste plain text into the input or upload a binary file.
  3. For decoding, paste a Base64 string into the input field.
  4. Select the variant if needed: standard Base64 or URL-safe Base64 (- and _ instead of + and /).
  5. Click Convert and copy the result from the output panel.

Your data never leaves your device — 100% private processing.

How Base64 encoding works

Base64 takes every 3 bytes of input (24 bits) and splits them into four 6-bit groups, each mapped to one of 64 printable characters (A–Z, a–z, 0–9, +, /). Because 3 input bytes become 4 output characters, the encoded size is always 133% of the original. If the input length is not divisible by 3, one or two = padding characters are appended to make the output length a multiple of 4.

Standard vs URL-safe Base64

Standard Base64 uses + and / which have special meaning in URLs (query-string separator and path separator), so embedding standard Base64 in a URL requires percent-encoding. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, making the encoded value safe to use directly in URL paths and query strings without additional encoding. JWTs use URL-safe Base64 without padding characters.

Base64 variant comparison
VariantCharacters 62–63PaddingUse case
Standard (RFC 4648 §4)+ and /= requiredMIME, email, file embedding
URL-safe (RFC 4648 §5)- and _OptionalJWT, URL parameters, filenames
MIME+ and /= with line breaksEmail attachments (76-char lines)

Worked examples

Encode text to Base64

Inputs: 'Hello'

Result: SGVsbG8=

Decode Base64 to text

Inputs: SGVsbG8=

Result: 'Hello'

Standard vs URL-safe

Inputs: bytes producing + / =

Result: URL-safe swaps + → -, / → _ and drops = padding

Base64 vs URL encoding vs HTML entities

Base64 vs URL encoding vs HTML entities
EncodingWhat it represents / escapesExampleTypical use
Base64Any bytes → 64 ASCII characters'Hello' → SGVsbG8=Binary in JSON, data URIs
URL (percent) encodingUnsafe/reserved URL characters → %XX'a b&c' → a%20b%26cQuery strings, URL paths
HTML entitiesMarkup characters < > & " → entities'<div>' → &lt;div&gt;Showing text safely in HTML

Glossary

Base64
A binary-to-text encoding scheme using 64 printable ASCII characters to represent arbitrary bytes.
Padding
The = characters appended to Base64 output to make its length a multiple of 4.
MIME
Multipurpose Internet Mail Extensions — a standard that uses Base64 to encode binary email attachments.
URL-safe Base64
A variant that substitutes + with - and / with _ to avoid conflicts with URL syntax.
Data URI
A URL prefixed with data: that embeds file content (often Base64-encoded) directly in HTML or CSS.

Related reading

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Related Developer Tools

Explore all Developer Tools.