Double Ratchet Explained: How Signal Keeps Every Message Safe

Double ratchet explained in plain terms means understanding the algorithm that gives Signal a fresh encryption key for every single message, and heals itself if a key is ever stolen. The central question is why a messaging app needs new keys constantly, and the answer is that a stolen key should unlock one message at most, never a whole conversation, and never the messages that come after.

The Double Ratchet was developed by Trevor Perrin and Moxie Marlinspike, published in 2013 as part of the Signal Protocol, and it is now the design behind Signal, WhatsApp, and several other secure messengers. It combines two mechanisms that each turn in one direction only, like a ratchet, so that keys move forward and can never move back.

This article explains what the Double Ratchet is, how it works, and why it matters.

Key takeaways

  • The Double Ratchet gives every message its own fresh encryption key.
  • It combines a symmetric-key ratchet with a Diffie-Hellman ratchet.
  • Stolen keys unlock at most one message, never the whole conversation.
  • It heals itself after a compromise, once the parties exchange new keys.
  • It powers Signal, WhatsApp, and several other secure messengers.

What the Double Ratchet is

The Double Ratchet is a key-management algorithm for messaging, a set of rules that decides how encryption keys are created, used, and thrown away as a conversation goes on. It sits underneath the Signal Protocol, and it is the reason Signal can promise that a stolen phone, a hacked server, or a leaked key does not expose a conversation’s history or its future.

The name comes from its two mechanisms. The first is the symmetric-key ratchet, a hash chain that derives a new message key from the previous one, and the second is the Diffie-Hellman ratchet, which performs a fresh key exchange every time the conversation changes direction. Each ratchet turns in one direction only, which is why keys can move forward and never backwards.

Forward secrecy is its first promise. Because every message key is derived from the previous one and then deleted, an attacker who steals the current key cannot work backwards to the keys that protected earlier messages. The past stays locked even when the present is compromised, which is what makes the ratchet different from a system that reuses one key for everything.

Future secrecy is its second promise, and it is the rarer one. If an attacker steals the whole state of a device, the Diffie-Hellman ratchet heals the conversation as soon as the parties exchange new keys, because the fresh exchange creates a secret the attacker never saw. The design is often called self-healing, and it is the property that sets the Double Ratchet apart from simpler schemes.

It handles messages that arrive out of order. Real networks deliver messages late, duplicated, or in the wrong order, and the ratchet stores a small number of skipped message keys so that a late message can still be decrypted when it arrives. That tolerance is part of the design, not an afterthought, because a messenger that loses messages is a messenger nobody uses.

Our guide to Diffie-Hellman explains the key exchange the ratchet depends on, and our guide to perfect forward secrecy explains the property the ratchet guarantees.

How the Double Ratchet works

Everything starts with a shared root key. When two people begin a conversation, they agree on an initial root key through the Signal Protocol’s handshake, and that key seeds the ratchet. The root key itself is never used to encrypt a message; it exists only to derive the chain keys that do the real work.

The symmetric-key ratchet turns with every message. Each time a message is sent, the current chain key is passed through a key-derivation function, which produces two outputs: a message key that encrypts this one message, and a new chain key for the next one. The old chain key is deleted immediately, so it can never be recovered, and the message key is deleted as soon as the message is decrypted.

The Diffie-Hellman ratchet turns when the conversation changes direction. Each side keeps a key pair for the current step, and when a reply arrives carrying the other side’s new public key, the receiver performs a fresh Diffie-Hellman exchange, mixes the result into the root key, and starts a new sending chain and a new receiving chain. The fresh exchange is what heals the conversation after a compromise.

Skipped keys are stored briefly. If a message arrives out of order, the receiver advances the chain past the missing messages, saving their keys in a small store, and decrypts the late message when it finally arrives. The store is capped at a small number, so a flood of fake messages cannot exhaust the device’s memory, and old skipped keys are deleted as soon as they are used.

Headers carry the information the receiver needs. Each message includes the sender’s current public key and two small numbers that say which chain it belongs to and which message in the chain it is, so the receiver can advance the right ratchet to the right step. The header is sent in the clear, because it reveals nothing about the message itself.

A dark office desk with two brass keys and a sealed envelope glowing green under a lamp, a locked steel box beside them
A dark office desk with two brass keys and a sealed envelope glowing green under a lamp, a locked steel box beside them, shows how the Double Ratchet works: every message gets a fresh key, and a stolen key opens one door and no more.

Comparing the Double Ratchet with other messaging designs

The Double Ratchet is one of several ways to protect a conversation, and each was built with a different emphasis. OTR, the older Off-the-Record protocol, offers forward secrecy but no self-healing, PGP encrypts messages with long-lived keys and no forward secrecy at all, and plain TLS protects messages in transit but leaves them readable on the server, and each approach trades safety for simplicity in a different way.

The table below sets out the main contrasts between the leading approaches.

Aspect Double Ratchet OTR PGP
Fresh key per message Yes Yes No
Self-healing Yes No No
Out-of-order messages Handled Handled Not applicable
Asynchronous messaging Yes No Yes
Best for Modern messengers Live chat Encrypted email

The practical result is that the Double Ratchet is the right choice for modern messengers, OTR suits live chat without offline delivery, and PGP fits encrypted email where forward secrecy is not the priority.

Where the Double Ratchet is used

Signal is its home. The app that set the standard for private messaging runs the Double Ratchet for every conversation, and its design is the reference implementation that other projects copy, which means the algorithm’s behaviour in the wild is exactly the behaviour its designers specified.

WhatsApp runs it at enormous scale. The world’s largest messaging service uses the Signal Protocol, including the Double Ratchet, for its end-to-end encrypted chats, which means billions of messages a day are protected by fresh per-message keys, and the design has proven itself at a scale no other ratchet has reached.

Matrix adopted it for its own protocol. The open messaging network uses the Olm ratchet, a design closely based on the Double Ratchet, for its encrypted rooms, and the choice shows how the algorithm has become the default answer for anyone building a secure messenger from scratch.

Other messengers followed the same path. Several privacy-focused chat apps, including some built for journalists and activists, chose the Double Ratchet because it is the only widely deployed design that offers both forward secrecy and self-healing, and those properties matter most to the people with the most to lose.

Research continues on its edges. Cryptographers study the ratchet’s behaviour under attack, looking for ways to strengthen its healing, to handle group chats better, and to prove its properties formally, and the work keeps the design at the centre of messaging security.

Strengths and limits

The greatest strength of the Double Ratchet is its combination of promises. Forward secrecy protects the past, future secrecy heals the future, and per-message keys limit every compromise to a single message, which is a set of guarantees that no earlier messaging design offered together.

It is also a strength that the design is proven in production. Billions of messages a day run through it, across Signal, WhatsApp, and Matrix, and that scale of deployment is itself evidence that the algorithm works in the real world, not only on paper.

The limits are real, though, and the biggest is complexity. The ratchet is harder to implement correctly than a simple encrypted channel, and mistakes in the state handling, the skipped-key store, or the header parsing can break the guarantees. Group chats are also a weakness: the ratchet was designed for two people, and groups need extra machinery on top.

Double Ratchet checklist

  • Use the Signal Protocol or a reviewed library; do not build a ratchet yourself.
  • Delete message keys immediately after use; never store them.
  • Cap the skipped-key store so a flood of messages cannot exhaust memory.
  • Verify the other side’s identity before the first ratchet step.
  • Remember group chats need extra machinery beyond the two-party ratchet.
  • Keep the implementation reviewed; use a well-known library.
  • Test out-of-order delivery; real networks never deliver in order.
  • Plan for device loss; the ratchet heals, but only after a fresh exchange.
  • Revisit the choice yearly; the field moves on even when ratchets do not.

Frequently asked questions

What is the Double Ratchet in simple terms?

It is a key-management algorithm that gives every message its own fresh key, deletes each key after use, and performs a new key exchange whenever the conversation changes direction, so a stolen key opens one message at most.

What is the difference between forward secrecy and future secrecy?

Forward secrecy means a stolen key cannot unlock past messages, and future secrecy, also called post-compromise security, means the conversation heals itself after a compromise, once fresh keys are exchanged.

Why are there two ratchets?

Because each one provides a different promise. The symmetric-key ratchet gives every message a fresh key cheaply, and the Diffie-Hellman ratchet provides the fresh shared secrets that heal the conversation after a compromise.

How does it handle messages that arrive out of order?

It stores a small number of skipped message keys, so when a late message arrives, the receiver can still decrypt it, and the store is capped so that a flood of fake messages cannot exhaust memory.

Is the Double Ratchet only used by Signal?

No. WhatsApp uses the Signal Protocol at enormous scale, Matrix uses a closely related design called Olm, and several other messengers have adopted the same ideas for their own protocols.

When should I use the Double Ratchet?

When building a messenger that needs forward secrecy and self-healing. Use the Signal Protocol or a reviewed library rather than implementing the ratchet from scratch.

The bottom line

Double ratchet explained in one line is this: the algorithm that gives every message a fresh key, deletes it the moment it is used, and heals the whole conversation the next time the two sides exchange keys.

It is the reason a stolen phone does not mean a stolen history, and the reason it matters is that a messenger should protect the past and the future, not only the present.

This article is general information about how the Double Ratchet works, not advice about choosing cryptography for a particular system.

Latest articles

Scroll to Top