Skip to content
Tool

Base64 Encoder / Decoder

Convert text or files to and from Base64. Live preview, URL‑safe mode, padding & line‑wrap controls — then download as text or decoded file.

Input mode
Direction
Chars: 0 · Bytes: 0
Chars: 0 · Bytes: 0

Binary mode saves decoded bytes as a file.

Live preview

            
Client‑side
UTF‑8 aware
URL‑safe
MIME wrap

How it works

1) Choose mode

Encode text/files to Base64 or decode Base64 back to text or bytes.

2) Customize

Set URL‑safe, padding, and line‑wrap length for encoded output.

3) Download

Copy or download the result. Use backend for big data.

Base64 Explained: Encoding, Decoding, and Best Practices

Understand what Base64 is, why it exists, and how to use it correctly for text, files, and data URLs.

What is Base64?

Base64 is a textual encoding that represents arbitrary bytes using 64 ASCII characters. It’s useful when binary data must travel through systems that only accept text (e.g., email bodies, JSON, HTML).

Base64 increases size by roughly ~33% because every 3 bytes (24 bits) become 4 characters (4×6 bits). The optional padding character = makes the output length a multiple of 4.

Why use it (and when not to)

  • Embed small images or fonts directly in CSS/HTML as data URLs.
  • Safely store binary blobs in JSON or database fields.
  • Avoid corruption when copy‑pasting bytes via text‑only channels.

Avoid Base64 for large assets in webpages: it bloats size, hurts caching, and can slow down rendering. Prefer normal file URLs/CDNs.

Standard vs URL‑safe

Standard Base64 uses + and /. URL‑safe replaces them with - and _ so the string can live in URLs without extra escaping. Padding = is sometimes omitted in URL contexts — our tool lets you toggle both behaviors.

Line wrapping

MIME email historically wraps Base64 at 76 characters per line. For APIs, it’s common to use no wrapping. Pick what your consumer expects.

Character encodings

When encoding text, we first turn it into bytes using UTF‑8. When decoding to text, we interpret bytes as UTF‑8 again. If your data isn’t textual, choose Binary output to download exact bytes.

Data URLs

A data URL looks like data:<mime>;base64,<payload>. Paste it in input and switch to Decode to extract bytes or text. Our tool auto‑detects and strips the header for you when decoding.

Pitfalls & limits

  • Not encryption — it’s just an encoding. Don’t put secrets in Base64 thinking they’re hidden.
  • Whitespace and newlines are ignored by most decoders, but extra non‑Base64 characters will fail.
  • Browsers have memory limits; prefer the backend button for very large files.

FAQ

Does Base64 change my data?

No — it’s reversible. Encoding/decoding returns the exact same bytes you started with.

When should I use URL‑safe?

When the string will live in a path, query, or filename. It avoids extra escaping.

Why do I see = at the end?

Padding makes length a multiple of 4. Some APIs allow omitting it — toggle it off if needed.

Is Base64 the same as hex?

No. Hex uses 16 symbols and is larger; Base64 uses 64 symbols and is more compact.