home / Other / base64 calculator

Base64 Encode and Decode

The Base64 Encode and Decode tool is a free online converter that turns text into Base64 and back again, with standard and URL-safe alphabets. Everything runs in your browser — nothing is uploaded — and it shows the size overhead encoding adds. No sign-up needed.

Type or paste text below. Conversion happens as you type.

Related: URL Encode Calculator | Password Generator Calculator

What Base64 Is For

Base64 represents binary data using only 64 printable ASCII characters. It exists because many systems — email, URLs, XML, JSON, HTTP headers — were designed for text and mishandle arbitrary bytes. Encoding binary as text lets it pass through them intact.

It is not encryption. Base64 provides no security whatsoever; anyone can decode it instantly, as this page demonstrates. Its purpose is safe transport, not confidentiality.

How the Encoding Works

Base64 takes three bytes (24 bits) and splits them into four 6-bit groups, each of which indexes into a 64-character alphabet.

StepExample with "Man"
ASCII bytes77, 97, 110
Binary (24 bits)01001101 01100001 01101110
Split into 6-bit groups010011 010110 000101 101110
As decimal19, 22, 5, 46
Mapped to the alphabetT, W, F, u
ResultTWFu

The alphabet is A–Z, a–z, 0–9, then + and /. Six bits give 64 possible values, which is where the name comes from.

Padding

When the input length is not a multiple of three, the encoder pads the output with = characters so the result is always a multiple of four.

Input bytesOutputPadding
34 charactersNone
23 characters + =One =
12 characters + ==Two =

The 33% Overhead

Four characters for every three bytes means Base64 output is always 4/3 the size of the input, before padding — a 33% increase. This is the fundamental cost of the encoding and cannot be avoided.

OriginalBase64Increase
1 KB1.37 KB+37%
100 KB133 KB+33%
1 MB1.33 MB+33%
10 MB13.3 MB+33%

This is why inlining large images as Base64 data URIs is usually a mistake: the file grows by a third, and unlike a separate image file, it cannot be cached independently.

Standard and URL-Safe Alphabets

 Standard (RFC 4648 §4)URL-safe (RFC 4648 §5)
Character 62+-
Character 63/_
Padding= required= usually omitted
Used inEmail, general encodingURLs, filenames, JWTs

The standard alphabet breaks inside URLs, because + means a space in query strings and / is a path separator. The URL-safe variant substitutes characters that carry no special meaning.

Where You Will Encounter It

  • Email attachments — MIME encodes binary attachments as Base64, which is the original use case.
  • Data URIsdata:image/png;base64,… embeds an image directly in HTML or CSS.
  • HTTP Basic authentication — the username and password are Base64 encoded, which is exactly why Basic auth must only be used over HTTPS.
  • JSON Web Tokens — the header and payload are URL-safe Base64, readable by anyone; only the signature is protected.
  • API keys and certificates — PEM files are Base64-encoded DER between BEGIN and END markers.

Common Problems

  • Missing padding. Many decoders reject input whose length is not a multiple of four. This tool adds the padding back automatically.
  • Line breaks. MIME inserts a newline every 76 characters. Strict decoders reject them; most tolerate them.
  • Wrong alphabet. Decoding URL-safe Base64 with a standard decoder fails on - and _ characters.
  • Unicode confusion. Base64 encodes bytes, not characters. Text must be converted to UTF-8 first, which this tool does — a character such as é is two bytes, not one.

Frequently Asked Questions

Is Base64 secure?

No. It is an encoding, not encryption, and reverses in a fraction of a second. Never use it to protect anything sensitive.

Why does my encoded string end in = signs?

Padding, added when the input length is not a multiple of three. One = means the last group held two bytes; two = means it held one.

Can I Base64 encode an image?

Yes, and that is what a data URI does. Be aware of the 33% size penalty and the loss of independent caching; it is worth it only for very small images such as icons.

Is my text sent anywhere?

No. The conversion happens entirely in your browser using its built-in functions. There is no network request and nothing is stored.