Base32 Encode and Decode

Encode text to Base32 and decode Base32 back to text.

Base32 Encode and Decode tool

About the Base32 Encode and Decode tool

Base32 uses only capital letters and the digits 2 to 7, which makes it safe for case-insensitive systems, file names and anything people may read aloud or type. It is the format behind the secret keys in two-factor authentication apps. This tool will base32 encode UTF-8 text using the standard RFC 4648 alphabet or the Base32hex variant, with or without padding, and decode it back: hello becomes NBSWY3DP. Treat any 2FA secret as sensitive and never share it.

Text is first turned into UTF-8 bytes. Every 5 bytes (40 bits) become 8 Base32 characters of 5 bits each, and the last group is padded with = signs to a multiple of 8 characters. Base32hex uses the digits 0 to 9 and letters A to V instead, which keeps sorted order. Decoding ignores spaces, line breaks and letter case, accepts input with or without padding, and points to the position of any character that is not part of the alphabet.

Example, from the RFC 4648 test vectors: f encodes to MY======, fo to MZXQ==== and foobar to MZXW6YTBOI======; in Base32hex, foobar is CPNMUOJ1E8======. Decoding MZXW6YTBOI gives foobar again, with or without the padding.

Base32 is an encoding, not encryption: anyone can decode it. Base64 is about 20% more compact; use the Base64 encoder where size matters. For hexadecimal bytes see the text to hex converter, and for binary the text to binary converter.

How to use the Base32 Encode and Decode tool

  1. Choose the directionEncode text to Base32, or decode Base32 to text.
  2. Pick the alphabetStandard RFC 4648 Base32, or Base32hex.
  3. Set padding and caseKeep or drop = padding; uppercase or lowercase output.
  4. Copy the resultErrors show the position of any invalid character.

Base32 Encode and Decode features

  • RFC 4648 Base32
  • Base32hex alphabet
  • UTF-8 text in any language
  • Padding on or off
  • Lowercase output option
  • Decoder ignores spaces and case
  • Position of invalid characters

Common uses

  • Two-factor authentication secrets
  • Case-insensitive identifiers and file names
  • DNS and onion address work
  • Debugging encoded data
  • Learning about encodings

Base32 in practice: entering a two-factor setup key, why the alphabet avoids 0 and 1, Crockford's variant, DNS labels and spotting typos

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Base32 exists for situations where text must survive people and case-insensitive systems: setup keys typed into authenticator apps, codes read over the phone, identifiers in DNS names and file names on systems that ignore letter case. This guide works through entering a two-factor setup key by hand, explains the design of the alphabet, compares the standard alphabet with Crockford's variant and covers DNS, file names, size and catching typing mistakes.

A worked example: a two-factor setup key

When a phone camera cannot scan a two-factor QR code, most sites offer a setup key to type instead, such as JBSWY3DPEHPK3PXP, often shown in groups of four letters for readability. Decoding it here shows it represents ten bytes, 80 bits of secret data. The authenticator app ignores spaces and letter case, so typing jbsw y3dp ehpk 3pxp works just as well.

The QR code itself usually contains a link in the form otpauth://totp/Example:ayesha@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example, where the secret is the same Base32 key. Treat any such key like a password: anyone who has it can generate your codes. Save the site's backup codes somewhere safe when you set up two-factor authentication.

Why the alphabet skips 0, 1, 8 and 9

The standard Base32 alphabet uses the letters A to Z and the digits 2 to 7. Leaving out 0 and 1 avoids confusion with the letters O, I and L when people read or type codes, and only 32 symbols are needed, so 8 and 9 are simply unnecessary. The result is a format that survives handwriting, phone calls and tired eyes much better than Base64.

Spotting typing mistakes

Because 0, 1, 8 and 9 never appear in standard Base32, a key containing one of them almost certainly contains a typing mistake: 0 typed instead of O, 1 instead of I or L, or 8 instead of B. Checking a rejected key for these characters often finds the problem in seconds. Decoders also reject other characters outside the alphabet, which points to the exact position of the error.

Crockford's Base32

A different Base32 alphabet, designed by Douglas Crockford, excludes the letters I, L, O and U instead and treats look-alike letters leniently when decoding. It is used by some identifier formats, including ULIDs. Its values are not interchangeable with standard Base32: the same data produces different text. When an identifier fails to decode, check which variant the system uses before assuming it is corrupted.

DNS names

Domain names ignore letter case and allow only letters, digits and hyphens, with each label limited to 63 characters. Base64 fails on both counts, as it relies on case and uses plus and slash, but lower-case Base32 fits. A full 63-character label can carry 39 bytes of data, which is why Base32 appears in systems that encode information inside DNS names.

File names on case-insensitive systems

Windows and macOS usually treat file names as case-insensitive, so two Base64 identifiers differing only in case, such as aB and Ab, would refer to the same file. Base32 identifiers avoid this collision entirely, making them a safer choice for names of cached or generated files that must stay unique across systems.

Size overhead

Base32 turns every 5 bytes into 8 characters, so encoded data is 60 percent larger than the original. Base64 adds about 33 percent. The extra length is the price of case-insensitivity and readability, which is worthwhile for short keys and codes but wasteful for large files or images, where Base64 or raw binary is better.

Reading codes aloud

Support teams sometimes read codes to customers over the phone. Base32 codes, grouped into blocks of four and spelled with a phonetic alphabet where needed, are far less error-prone than mixed-case codes, because there is no need to say upper or lower case for each letter. Designing customer-facing codes this way saves time and mistakes.

Padding

Standard Base32 pads output with equals signs to a multiple of eight characters. Two-factor keys, URLs and many identifiers drop the padding because it carries no information. A tolerant decoder, like this one, accepts input with or without it, but some strict libraries require padding, so add it back if a library rejects an otherwise valid string.

Common mistakes

  • Treating Base32 as encryption.
  • Mixing standard Base32 with Crockford's variant.
  • Mistyping O as 0 or I as 1 in setup keys.
  • Using Base32 for large data where its size overhead is wasteful.

Related tools

To put an otpauth link into a scannable code, use QR Code Generator. To create strong secrets, try Password Generator, and for the more compact encoding, Base64 Decoder.

Designing your own codes

When creating voucher codes, recovery codes or licence keys that people will type, Base32 is a sensible foundation. Generate random bytes, encode them, drop the padding and display the result in groups of four. Adding a check character computed from the rest lets your system reject most typing mistakes before looking anything up.

Privacy

Encoding and decoding happen in your browser. Keys and text are not uploaded or stored, but avoid pasting live two-factor secrets into any tool unless necessary.

Frequently asked questions

What is Base32?

An encoding defined in RFC 4648 that represents binary data with 32 characters: A to Z and 2 to 7. It avoids 0, 1 and 8 so they are not confused with O, I and B.

How do I decode Base32?

Choose decode and paste the text. Spaces, line breaks and lowercase letters are accepted, and padding is optional. If a character is invalid, its position is shown.

What is the difference between Base32 and Base64?

Base64 uses 64 characters, including lowercase letters and + and /, so it is about 20% shorter. Base32 is case-insensitive and avoids symbols, which suits humans, DNS and file systems.

What is Base32hex?

A variant in the same RFC that uses 0 to 9 and A to V. Encoded strings keep the same sort order as the original data, which is useful for database keys and DNS NSEC3 records.

Why does Base32 end with = signs?

Padding. The output is grouped in blocks of 8 characters, and = fills the last block when the data length is not a multiple of 5 bytes. Some systems omit it.

Are 2FA secret keys Base32?

Yes. Authenticator apps such as Google Authenticator store TOTP secrets as Base32 strings, usually without padding and shown in groups of four characters. You can decode one here to see the raw bytes, but keep secrets private.

Is Base32 secure?

No. It is an encoding, not encryption, and anyone can decode it instantly. Never treat Base32-encoded data as protected. To protect data, encrypt it first with a proper tool such as the text encryption tool, then encode the result if you need plain characters.

Does it support emoji and other languages?

Yes. Text is converted to UTF-8 bytes before encoding, so any language and emoji round-trips correctly when decoded with UTF-8. Decoding checks that the bytes form valid UTF-8 and warns you if they do not.

How long is Base32 output?

Eight characters for every five bytes of input, so Base32 is 60% longer than the original data, compared with 33% for Base64. Padding rounds the length up to a multiple of eight.

Is Base32 case-sensitive?

No. RFC 4648 Base32 uses only uppercase letters and digits, and decoders, including this one, accept lowercase input too, which is why it suits keys that people type.