Skip to content

Base32 encoder and decoder

Free, no sign-up Runs in your browser

Encode text or hex bytes to Base32 and decode Base32 back, in the standard or the extended hex alphabet of RFC 4648. Reads TOTP secrets as people write them.

Direction
Alphabet

TOTP secrets, onion addresses and most tools use the standard alphabet.

The input is
Base32
The result appears here.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the base32 encoder and decoder

  1. Choose to encode or decode, and the alphabet.
  2. When encoding, say whether the input is text or hex bytes.
  3. Paste the input. The result updates as you type.
  4. Copy the Base32, or read the decoded text and hex.

About this tool

Base32 writes bytes with 32 characters: the letters A to Z and the digits 2 to 7. Every five bytes become eight characters, so the output is 60 percent longer than the input, more than Base64. What it gains is being easy for people. It has one letter case, no punctuation, and it leaves out 0, 1 and 8, which are easily mistaken for O, I and B when read aloud or typed from a screen.

That is why the secrets behind authenticator apps are Base32. The text under a two-factor QR code, something like JBSWY3DPEHPK3PXP, is the shared TOTP key in this encoding. You also meet Base32 in onion addresses and in some DNS records. RFC 4648 defines a second alphabet, extended hex, which uses 0 to 9 and A to V so that encoded values sort in the same order as the bytes.

Like every encoding here, Base32 hides nothing. A TOTP secret in Base32 is the secret itself: anyone who has it can generate your codes. The decoder accepts lower case, spaces, dashes and missing padding, the way secrets are shown to people, and shows the bytes in hex because a key is usually not readable text.

Sources

Questions

What is Base32 used for?

Places where a person has to read or type the value, or where letter case is not preserved. The best known are the TOTP and HOTP secrets of authenticator apps, onion addresses, some DNS records and file names on case-insensitive systems.

What is the difference between Base32 and Base64?

Base32 uses 32 characters in one letter case and makes data 60 percent longer. Base64 uses 64 characters in both cases plus two symbols and makes data 33 percent longer. Base64 is more compact; Base32 is safer to read aloud and type.

Why does Base32 have no 0, 1, 8 or 9?

The standard alphabet uses only 2 to 7 for digits, so that 0 is not confused with O, 1 with I or L, and 8 with B. The extended hex alphabet is a different set and does use 0 to 9.

Is a TOTP secret in Base32 encrypted?

No. Base32 is a reversible encoding with no key. The string shown when you set up two-factor authentication is the shared secret, so store it as carefully as a password.

Related tools