Base64 Converter

Encode text to Base64 and decode it back, RFC 4648.

Technology and NetUpdated 2026-10-101 min read
Base64 Converter
Up to 1000 characters, UTF-8 handled.
A-Z, a-z, 0-9, +, / with = padding.
Result
...
Output length...
Input length...

What it does

Base64 packs arbitrary bytes into 64 safe ASCII characters so binary survives email, URLs, and JSON. Every three input bytes split into four 6 bit groups, each indexing one alphabet letter, with equals signs padding short tails.

The tool above encodes text (UTF-8 aware) or decodes back with strict alphabet checks. It returns the result with both lengths beside it.

The default Hello (5 chars) encodes to SGVsbG8= (8 chars): five bytes need two quanta, padded once. Decoding reverses exactly to Hello.

The alphabet and padding follow IETF RFC 4648 with MDN btoa references matching browser behavior. Both use A-Z, a-z, 0-9, plus, slash, and equals padding.

How to use

  1. Pick encode or decode first.
  2. For text, type up to 1000 characters.
  3. For Base64, paste a multiple of 4 length.
  4. Read the result first for the conversion.
  5. Use lengths to check payload budgets.

Formula

3 bytes (24 bits) to 4 chars (6 bits each). Padding: 1 byte left gets ==, 2 bytes get =.
64
Alphabet size fitting 6 bits per char.
=
Pad filling short final quanta.
4/3
Size growth factor plus padding.

Unicode encodes as UTF-8 bytes first, so emoji cost four bytes each. URL safe variants swap two chars and sit outside this standard page.

Worked example

Example: encode Hello

Text Hello, direction encode.

  1. Bytes: H(72) e(101) l(108) l(108) o(111).
  2. First three bytes to 24 bits, split in four sixes.
  3. Remaining two bytes plus one pad char.
  4. Result SGVsbG8=: 8 chars from 5.
  5. Tool shows SGVsbG8=, 8 chars, 5 chars in.

Reference table

Padding by tail length
Tail bytesCharsPadding
3 (full)4none
1 left2==
2 left3=
Hello (5)8=

Limits

  • Standard alphabet only, not URL safe variant.
  • 1000 chars in, 1500 chars for decode.
  • Text mode assumes UTF-8 content.
  • Binary files need upload tools instead.

Common mistakes

  • Decoding URL safe strings with plus slash logic.
  • Dropping padding then failing strict checks.
  • Counting Base64 length as byte length.
  • Feeding raw Unicode to naive btoa.
  • Wrapping lines mid quantum.

Try it yourself

Quick checks. Answers sit tucked under each question.

Decode SGVsbG8=?

Hello: 5 chars from 8.

Encode Hi?

2 bytes: SGk= (3 chars plus pad).

Length growth?

About 4/3 plus padding: 5 chars become 8.

Questions

What is Base64?

Binary to 64 safe ASCII chars for email, JSON, and URLs.

Why the equals signs?

Padding completing short final byte groups per RFC 4648.

Is it encryption?

No. Encoding only: anyone decodes it instantly.

Unicode safe?

Here yes: UTF-8 bytes encode first, then alphabet.

URL safe variant?

Swaps +/ for -_ and often drops padding; separate standard.

Why bigger output?

Six bits per char against eight per byte: 4/3 growth.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.