The Black Chamber RU

Tools · Codes and encodings

Base64, hex and binary

Convert text to and from Base64, Base32, hex, binary and decimal bytes (UTF-8).

Runs in your browser. Your text goes nowhere.

How to use it

Paste anything into the “Input” box: plain text, a Base64 string, hex bytes, ones and zeros, or decimal numbers. With “Input is” set to “Auto” the tool guesses the format and tells you what it saw. Below, the same bytes are shown in every notation at once: text, hex, binary, decimal, Base64 and Base32. The one the input was read from is marked with a red arrow.

If the guess is wrong, pick the format yourself. The string 1234, for instance, is perfectly valid hex (two bytes), valid Base64 (three bytes) and valid text. Only you know which was meant.

Text always becomes bytes through UTF-8. An English letter takes one byte; accented and non-Latin letters take more. “A” is 41, while the Russian “я” is two bytes, d1 8f.

The onion

Sometimes a text is wrapped several times: first in Base64, then those characters in hex, then the hex digits in binary. The “onion” panel peels such layers one at a time. At each step it tries every format and keeps the one that gives readable text; when several fit, you can switch between them. “An example onion” loads a three-layer sample: binary → hex → Base64 → a sentence.

How Base64 works

Base64 takes bytes three at a time, 24 bits, and cuts them into four pieces of 6 bits. Each piece is a number from 0 to 63 and stands for one of 64 characters: A–Z, a–z, 0–9, “+” and “/”. The word “Man” becomes TWFu. When the last group is short of three bytes, the output is padded with “=”: “Hi” is SGk=. That is why Base64 is always about a third longer than the data.

Questions

Is Base64 encryption?

No. It is an encoding: the rule is public, there is no key, and anyone can decode a string in a second. Base64 exists to carry bytes where only text is allowed, such as email, URLs or JSON. More in the lesson on encodings.

How is Base32 different?

Base32 cuts the bits into fives and needs only 32 characters: capital letters and the digits 2–7. The string is longer, but there are no lowercase letters and no look-alikes such as 0 and O. You meet Base32 in the secret keys of two-factor authentication apps.

What is hex?

Hexadecimal: counting in sixteens with the digits 0–9 and a–f. One byte is always exactly two hex digits, from 00 to ff, which makes hex the usual way to show raw bytes.

Does my data go anywhere?

No. Everything is computed in your browser.