Codec lesson · Base32

Base32: represent bytes with a 32-symbol alphabet

Base32 uses uppercase A–Z and digits 2–7. Its alphabet avoids visually ambiguous 0, 1, 8, and 9, but the encoded result is longer than Base64.

Standard · RFC 4648 Round trip: Exact for canonical padded Base32 whose bytes are valid UTF-8 text.
Learning objective

Recognize RFC 4648 Base32, explain its padding, and validate canonical Base32 before decoding it as UTF-8 text.

Encode Keyboard groups UTF-8 bits into five-bit values, maps them to the RFC 4648 Base32 alphabet, and pads the result to an eight-character boundary with =.

01

How Encode Keyboard handles it

1

Convert text to UTF-8

All characters, including Vietnamese and emoji, begin as bytes.

2

Read five bits at a time

Each value from 0 to 31 selects A–Z or 2–7.

3

Require canonical blocks

Decode accepts uppercase symbols and trailing padding only when re-encoding produces the same value and the bytes form valid UTF-8.

02

Worked example

InputHi
OutputJBUQ====

Two input bytes leave a partial five-bit group, so four = characters complete the eight-character block.

03

Good uses

  • Learning binary-to-text encodings
  • Inspecting values explicitly documented as RFC 4648 Base32
  • Sharing non-sensitive text in a case-stable alphabet
04

Validation and common errors

  • Use uppercase A–Z and digits 2–7 only
  • Keep = only at the end and use the canonical count
  • The total canonical length must be a multiple of eight
05

Practice in your browser

This uses the same documented rules as the app and runs only in this tab.

Base32This uses the same documented rules as the app and runs only in this tab.
Result

This uses the same documented rules as the app and runs only in this tab.

06

Knowledge check

Which digits belong to the RFC 4648 Base32 alphabet?