Skip to content
Technologydeveloper

Base64 Encoder and Decoder

Base64 encoding and decoding, including the URL-safe variant. Base64 is an encoding, not encryption: anyone can decode it, so it hides nothing.

Also called: base64 encode decode, b64 converter.

Text to encode, or Base64 to decode.

Direction
Result
TnVtZXJh

TnVtZXJh. 6 characters in, 8 out, a 33.33% change. The standard alphabet uses plus and slash, which need escaping in a URL.

Input length
6
Output length
8
Size change
33.33
Input bytes
6
On the variant
The standard alphabet uses plus and slash, which need escaping in a URL.
On privacy
This runs in your browser. Nothing you paste is sent anywhere, which matters for anything sensitive.
Method and background

How this is calculated

Base64 maps every three bytes to four printable characters, which is why encoded output is about a third larger than the input. It exists to carry binary data through channels that only accept text, not to conceal anything: decoding requires no key and takes no effort. The URL-safe variant replaces the plus and slash characters with minus and underscore so the result survives being placed in a URL or filename without escaping.

three bytes become four characters, which is why Base64 adds about a third to the size
n
Input bytes

Worked examples

Each of these is asserted on every build. If a change to the engine ever moved one of these answers, the build would fail before the page could print it.

encoding a short string

Text
Numera
Direction
Encode
URL safe variant
No

ResultTnVtZXJh

Six bytes become eight characters, the 3 to 4 ratio

Open this example

decoding returns the original

Text
TnVtZXJh
Direction
Decode
URL safe variant
No

ResultNumera

boundary: the round trip

Open this example

Method and limits

What it assumes

  • UTF-8 for the text encoding, which affects the byte count for non-ASCII input.

What it deliberately does not model

  • Base64 provides no confidentiality whatsoever.
  • Non-ASCII characters take multiple bytes, so the encoded length grows faster than the character count suggests.

Formula version 1.0.0 · definition 1.0.0 · United States · Report a problem with this calculator

Frequently asked questions

Is Base64 encryption?
No. It is an encoding with no key, and anyone can reverse it instantly. Treating Base64 as a way to hide a secret is a common and serious mistake.
Why is the output larger?
Three bytes become four characters, so the output is about a third bigger. Padding with equals signs rounds it up to a multiple of four.