Visual RFC.
ALL RFCs / RFC 6455
Read the RFC ↗
RFC 6455 / PROTECT THE TRANSPORT

Client masking

05

Each client frame uses a new unpredictable masking key, repeated across its payload bytes.

RFC 6455 · § 5.3EXAMPLE
3 / 3
03
Recover the original payload.

The server uses the transmitted key; anyone observing the key can also undo the mask.

Client maskingA five-byte payload is XORed with a repeating four-byte key; applying the same key recovers the original bytes.Client masking, byte by byteIllustrative bytes in hexadecimalpayload48656C6C6Fkey37FA213D37Four unpredictable key bytes repeat; key[4] = key[0]wire XOR7F9F4D5158XOR again48656C6C6FThe key is sent too: masking is not encryptionXOR again to recover the original payload

Key idea: Mask every client frame; use TLS for confidentiality.

Terms

Look up a term in the glossary ↗

Rules & examples
  • The client chooses a fresh unpredictable 32-bit masking key for every frame, including control frames.
  • Payload byte i is XORed with key byte i modulo 4. The receiver uses the same operation to recover it.
  • Masking protects intermediaries from attacker-chosen wire patterns; the key travels with the frame, so masking does not hide content.

The byte example is deliberately tiny. Masked client frames and unmasked server frames are required even when TLS is used.

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

A request starts a conversation.

A client asks for a resource. A server sends a response. The method, address, headers, and status explain what that conversation means.

Helpful first, if these ideas are unfamiliar

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 6455

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 ↗