Tools
Log in
English

All converters

Base64 encoder and decoder

Encode text to Base64 or decode it back, with a URL-safe option and UTF-8.

Result

Hex
Binary
Decimal
Unicode
More octal, code points
Octal
Code points (decimal)

Settings

Base64 writes any bytes using 64 safe characters: every 3 bytes become 4 characters, and = fills the end when bytes run short. Paste text to encode it, or paste Base64 to read it back as UTF-8 text; the URL-safe form uses - and _ in place of + and /. Free to use, nothing to register.

How to do it by hand

  1. Turn the text into bytes, usually with UTF-8.
  2. Take the bytes three at a time, which gives 24 bits.
  3. Split the 24 bits into four 6-bit pieces and look each one up in the 64-character table.
  4. If the last group has only one or two bytes, add = or == at the end.

Worked examples

Man

4D 61 6E → 010011 010110 000101 101110 → 19, 22, 5, 46

TWFu

ab

61 62 → 011000 010110 001000 → 24, 22, 8, then one =

YWI=

안녕 (UTF-8)

EC 95 88 EB 85 95 → two groups of three bytes

7JWI64WV

Common mistakes

  • Treating Base64 as encryption. Anyone can decode it, so it hides nothing.
  • Decoding URL-safe Base64 as the standard form. If you see - or _, turn on the URL-safe option.
  • Ignoring the text encoding. The same word gives different Base64 in UTF-8 and in EUC-KR.

The 64 Base64 characters

ValueCharValueCharValueCharValueChar
0A16Q32g48w
1B17R33h49x
2C18S34i50y
3D19T35j51z
4E20U36k520
5F21V37l531
6G22W38m542
7H23X39n553
8I24Y40o564
9J25Z41p575
10K26a42q586
11L27b43r597
12M28c44s608
13N29d45t619
14O30e46u62+
15P31f47v63/

URL-safe Base64 uses - for 62 and _ for 63, and usually drops the = padding.

Questions people ask

Why is Base64 longer than the original?

Every 3 bytes become 4 characters, so the result is about a third longer.

Can I leave out the = at the end?

Some systems drop it, especially in URL-safe tokens. Strict decoders may still need it, so keep it unless you know the other side accepts it without.

Why does my decoded text look broken?

The bytes inside were probably not UTF-8 text, or the Base64 was cut short. Check that you copied the whole string.