Base64 encoder & decoder

Convert between text and Base64 both ways, with full UTF-8 support, a URL-safe variant, and file-to-Base64. Runs fully in your browser.

Input (plain text or Base64 — both work)
Result
—
Enter content, then click Encode or Decode.
Options & files
· Converting files to Base64 is commonly used to embed small files like images or fonts into HTML / CSS — note that larger files produce longer strings.
· Large files (>2MB) produce very long Base64 output and may slow the browser down; small files are recommended.

How the encoding works

Base64 takes binary data three bytes at a time (24 bits) and re-splits it into four 6-bit groups. Each group maps to one of 64 printable characters: A–Z, a–z, 0–9, plus + and /. The result is text that survives any channel that only accepts plain ASCII.

Because three bytes become four characters, encoded output is about 33% larger than the input. If the input length is not a multiple of three, the encoder pads the last group with = — one pad for a two-byte remainder, two pads for a one-byte remainder.

What it is not

Base64 is not encryption and provides no secrecy whatsoever. Anyone can decode it in one step. It is a transport encoding: its job is to make binary safe to carry, not to hide it. If you need confidentiality, encode and then encrypt — never encrypt "with" Base64.

Where it shows up

ContextWhy Base64 is used there
Email attachments (MIME)SMTP was designed for 7-bit text and cannot carry raw binary
Data URIs in CSS and HTMLLets a small image be embedded directly in a stylesheet
JSON and XML payloadsCarries a binary field inside a text document
JWT (JSON Web Tokens)URL-safe Base64 of the header, payload and signature
HTTP Basic authenticationUsername and password joined by a colon, then encoded

Standard vs URL-safe alphabet

The standard alphabet uses + and /, both of which have meaning inside a URL. The URL-safe variant (RFC 4648 §5) swaps them for - and _ and often drops the = padding. A string decoded with the wrong alphabet will either fail or silently produce garbage, so check which flavour a system expects — JWT always uses the URL-safe one.

A quick sanity check

The word Man encodes to TWFu, and Ma encodes to TWE= with a single pad. If you can reproduce those two by hand, the algorithm has clicked.

Related tools

Image ⇄ Base64 Hash generator Encrypt / decrypt

FAQ

Is Base64 encryption?
No. Base64 is just an encoding scheme that represents binary data with 64 printable characters. Anyone can decode it directly, so it cannot protect privacy — use real encryption for sensitive data.
Why does non-ASCII text get longer after encoding?
In UTF-8, a character outside ASCII takes 2 to 4 bytes, and Base64 encodes every 3 bytes into 4 characters, so non-ASCII content grows noticeably. This is normal.
What is the difference between URL-safe Base64 and standard Base64?
Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe variant replaces + with -, / with _, and strips the trailing = padding, so the result can be used directly in URLs and filenames.
Is my content uploaded during encoding or decoding?
No. All conversions run locally in your browser. Neither text nor files are sent to any server.