TechWeirdoTools

Converter

0 chars

How to encode or decode Base64

  1. Choose Encode or Decode

    Encoding turns text into Base64; decoding turns Base64 back into readable text. Results update as you type.

  2. Pick the variant

    Turn on Base64URL for JWTs, URLs and filenames. Turn on 76-character wrapping for email (MIME) and PEM-style output.

  3. Work with files

    Use File → Base64 to embed images or fonts as data URIs, and Base64 → File to turn a pasted string back into a downloadable file.

What is Base64?

Base64 represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. It exists so binary data can travel safely through systems built for text: email, JSON, HTML attributes, HTTP headers and URLs.

Base64 vs Base64URL

Base64 (RFC 4648 §4)Base64URL (RFC 4648 §5)
Characters 62 and 63+ and /- and _
Padding= to a multiple of 4Usually omitted
Used inEmail, data URIs, PEM, Basic authJWTs, URLs, filenames, WebAuthn

Base64 is encoding, not encryption

Anyone can decode Base64 — it provides no secrecy. Never use it to “hide” passwords or API keys. If you need confidentiality, use real encryption; if you need integrity, use a hash or signature.

Command-line equivalents

echo -n 'hello' | base64           # aGVsbG8=
echo 'aGVsbG8=' | base64 --decode   # hello
base64 -i image.png -o image.b64     # macOS file encode
certutil -encode in.bin out.b64      # Windows

Frequently asked questions

Is my data uploaded when I encode or decode?

No. Encoding and decoding run entirely in your browser with JavaScript. Text and files never leave your device.

Why does btoa() fail with emoji or accented characters?

The browser’s btoa() only accepts Latin-1 characters. This tool first encodes text as UTF-8 bytes with TextEncoder, then Base64-encodes the bytes, so every language and emoji round-trips correctly.

How do I convert an image to Base64?

Open the File → Base64 tab and drop your image. Copy the data URI (for an <img src>), the raw Base64, or a ready-to-paste CSS url() value.

Why is my decoded output garbled?

The Base64 probably encodes binary data (an image, PDF or compressed file) rather than text. Use the Base64 → File tab to download it — the file type is detected automatically from its signature.

Do I need the = padding at the end?

Padding makes the length a multiple of 4. Many decoders, including this one, accept Base64 with or without it. Base64URL usually omits it.