What Is a CRDT? Explainer
A conflict-free replicated data type, or CRDT, is a data structure designed so copies on different computers can be updated independently and still merge into the same result. That is useful when users edit offline, services span regions, or a network partition prevents replicas from coordinating before every write. Instead of treating concurrent changes as an exceptional conflict for a person or central leader to resolve, the data type defines mathematical rules that make merging deterministic. When two replicas have received the same set of updates, those rules lead them to the same state even if messages arrived in different orders.
There are two broad families. A state-based CRDT periodically sends some or all of its current state and combines states with a merge operation that is associative, commutative, and idempotent. Those properties mean replicas can merge in any order, can repeat a message, and still reach the same answer. An operation-based CRDT sends the updates themselves, such as an increment or an insertion. It can use less bandwidth, but the delivery system must satisfy the assumptions of that particular design, often including reliable delivery and causal ordering. Delta-state variants send only compact pieces of state to reduce the cost of full-state exchange.
The simplest example is a grow-only counter. Each replica keeps its own nondecreasing component and increments only that component. Merging takes the maximum value for every replica, and the visible count is the sum. A grow-only set merges by union. Supporting removal is harder because one replica may add an item while another removes what it previously saw. Designs such as observed-remove sets attach identifiers or causal context so a removal affects the intended additions without erasing a genuinely later add. Sequences used for collaborative text need rules for placing concurrent insertions and preserving a stable order.
CRDTs provide convergence, not a universal definition of correctness. A last-writer-wins register can converge by choosing the value with the greatest timestamp, yet clock errors or the chosen tie-break rule may produce a result users dislike. A shopping cart may be able to merge added items safely, while a bank withdrawal cannot simply be duplicated across disconnected replicas without preserving an account invariant. Some CRDTs consume extra metadata, retain tombstones for deleted elements, or need garbage collection once all replicas have observed an update.
Systems therefore select CRDTs according to the meaning of the data. Counters, sets, maps, registers, and collaborative sequences each need different merge behavior. Applications may also combine CRDTs with permissions, transactions, causal consistency, or coordination for operations that must obey a global rule. The useful insight is that many apparent conflicts are not arbitrary: if the data type defines exactly how concurrent updates compose, replicas can stay available and responsive locally, synchronize later, and settle on one predictable result without a central lock around every change.
A CRDT is a replicated data type whose update and merge rules guarantee that replicas converge after receiving the same information. Key terms include replica, concurrent update, convergence, commutative, associative, idempotent, causal order, state-based, operation-based, delta state, and tombstone.
The data type limits updates and defines a merge that produces the same result regardless of message order or duplication. State-based designs merge states with algebraic rules, while operation-based designs exchange updates under defined delivery assumptions. Coordination is avoided only for operations the CRDT is designed to represent.
Convergence does not automatically preserve business rules, prevent unauthorized writes, or choose the result people consider fairest. Some designs add metadata, retain tombstones, or require careful garbage collection. Operations such as limited inventory or account withdrawals may still need coordination to maintain global invariants.
Explore more "Explainers"
Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.
