Visual RFC.
ALL RFCs / RFC 4648
Read the RFC ↗
RFC 4648 / MECHANISM GUIDE

What fills the last row when the data runs out?

02

Filling bits and equals-sign ending marks have different jobs. Neither adds an extra data byte.

RFC 4648 · § 3.2EXAMPLE
1 / 4 · The final group may be short

We still start with whole input bytes, never a fraction of a byte.

Original data pieces

Byte 1f8 bits

Each tiny place is a bit: filled = on, empty = off.

What happens if you change this?

Make one change, then watch again. Restart restores the original example.

3 / 3
03
Complete the quantum

TQ== represents the original one byte.

What fills the last row when the data runs out?Filling bits and equals-sign ending marks have different jobs. Neither adds an extra data byte.What fills the last row when the data runs out?M = 01001101TQ==Zero pad bits complete the second groupTQ== decodes to one byte

Key idea: Zero filling bits complete a symbol. Equals signs describe the end; they are not extra bytes.

Terms
Base encoding
A reversible way to represent bytes with a selected alphabet of text symbols. It is not encryption.
Alphabet
The agreed dictionary of symbols. Base64 and Base64url use different alphabets.
Byte / bit
One byte contains eight on-or-off values called bits.
Padding / pad bits
Equals-sign ending marks / zero filling bits inside the final data symbol. They are different things.
Profile
The containing format’s explicit extra rules, such as whether padding is omitted.
Canonical form
A specified consistent spelling. Being decodable does not guarantee that spelling.

Look up a term in the glossary ↗

Rules & examples
  • Encoders must include padding unless the referring specification explicitly says otherwise.
  • Unused pad bits must be zero for canonical encoding.
  • A decoder may reject nonzero pad bits according to its profile.

Examples are illustrative. Consult the linked RFC and its errata for implementation details.

RFC 4648 §§3.2,3.5,4. Encoders MUST use zero pad bits and MUST include padding unless the referring specification explicitly says otherwise. This chosen decoder permits nonzero pad bits to demonstrate the difference: decoders MAY reject them. 4 filling bits; 2 equals signs under this selected profile. Output Zg==.

Sources
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

First, agree how to read the message.

An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.

Start with this guide; no earlier guide is needed for the overview.

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

All chapters in RFC 4648

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗