WhatsApp System Design

End-to-End Encryption

2 min read

End-to-End Encryption (E2EE) ensures that only the intended recipients can read a message.

Even the messaging server cannot decrypt the content.


Encryption Flow

The server only forwards encrypted data.

It never sees the plaintext.


What Does the Server Store?

Typically something like

Encrypted Payload

Message ID

Conversation ID

Timestamp

Notice

The payload is encrypted.

The metadata is not.

Metadata is still required for routing and delivery.


Why Metadata Matters

Without metadata,

the server wouldn't know

  • Who sent the message

  • Which conversation it belongs to

  • Who should receive it

Encryption protects content,

not routing information.


Temporary Storage

If the recipient is offline,

the encrypted message is temporarily stored until delivery.

Because the payload is encrypted,

the server still cannot read its contents.


Interview Notes

Interviewer

Can the messaging server read encrypted messages?

Answer

No.

The server stores and forwards encrypted payloads.

Only recipient devices can decrypt them.


Key Takeaways

✔ Content is encrypted before leaving the sender.

✔ Servers forward encrypted payloads.

✔ Metadata remains available for routing.

✔ Offline delivery still works using encrypted temporary storage.