---
title: "How CRDTs make multiplayer text editing part of Zed's DNA"
description: "Zed builds collaborative editing into its core using CRDTs rather than Operational Transformation, making concurrent edits commutative by addressing text through stable logical anchors (insertion id plus offset) instead of absolute offsets."
url: "https://swe.quest/articles/how-crdts-make-multiplayer-text-editing-part-of-zed-s-dna-b0f0df37585dbddf"
canonical: "https://zed.dev/blog/crdts"
source: "Zed"
published: "2022-12-01"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 12
tags: ["local-first","realtime","consistency","algorithms","rust"]
---

# How CRDTs make multiplayer text editing part of Zed's DNA

A post on [Zed](https://swe.quest/sources/zed.md), published 2022-12-01, 12 min read, Deep dive. Original: [https://zed.dev/blog/crdts](https://zed.dev/blog/crdts)

## Summary

Zed builds collaborative editing into its core using CRDTs rather than Operational Transformation, making concurrent edits commutative by addressing text through stable logical anchors (insertion id plus offset) instead of absolute offsets. Each insertion gets a unique id from a centrally assigned replica id and a sequence number. Deletions are tombstones tagged with version vectors so concurrent insertions inside a deleted range stay visible, and concurrent inserts at the same spot are ordered by descending Lamport timestamp with replica id as tiebreaker to respect causality. Per-user undo/redo is also covered, and a copy-on-write B-tree avoids linear scans when resolving anchors.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Local-first & sync](https://swe.quest/tags/local-first.md) (Architecture & design)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)
- [Consistency models](https://swe.quest/tags/consistency.md) (Distributed systems)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [Rust](https://swe.quest/tags/rust.md) (Languages)

## Prerequisites

- distributed systems basics ([easy posts on Distributed systems](https://swe.quest/tags/distributed-systems.md?difficulty=easy))
- eventual consistency ([easy posts on Consistency models](https://swe.quest/tags/consistency.md?difficulty=easy))
- logical clocks ([easy posts on Time & clocks](https://swe.quest/tags/time-clocks.md?difficulty=easy))

## Keywords

Zed, CRDT, Operational Transformation, Lamport timestamps, version vectors, tombstones

## Related posts

- [This Week at Zed Industries: #12](https://swe.quest/articles/this-week-at-zed-industries-12-12effbc7b871501a.md): Zed · 2023-07-21 · Medium · 7 min read · Rust, Real-time systems, Consistency models, Developer tools, Replication
  Zed publicly launched its preview channel and reports progress across the editor: Vim search commands, macOS ctrl-click remapped to right click in the platform layer, terminal Cmd+hover navigation, a semantic index that collapses nested tree-sitter symbols to cut embedding tokens, and a lock-contention bug where slow git status in huge repos serializes file scanning.
- [Text Coordinate Systems](https://swe.quest/articles/text-coordinate-systems-5ea8fbb000ee9f93.md): Zed · 2024-06-27 · Medium · 11 min read · Rust, Data structures, Developer tools, Real-time systems, Time & clocks
  Zed represents text positions with several coordinate types, each suited to a different job.
- [This Week at Zed Industries: #14](https://swe.quest/articles/this-week-at-zed-industries-14-199a97b20076bb41.md): Zed · 2023-08-04 · Easy · 6 min read · Distributed systems, Replication, Data structures, Developer tools, Rust
  Zed's weekly update covers a reworked search UI with semantic search, the start of WebAssembly extensions for custom language servers, and near-complete collaboration channels.
- [Xanadu Was Waiting for Agents](https://swe.quest/articles/xanadu-was-waiting-for-agents-d8ee9682901d8286.md): Zed · 2026-09-01 · Easy · 6 min read · Version control, AI agents, Local-first & sync, Developer tools
  Ted Nelson's Project Xanadu specified permanent versioning, span-level attribution and transclusion decades before its dependencies existed.
- [pg\_crdt - an experimental CRDT extension for Postgres](https://swe.quest/articles/pg-crdt-an-experimental-crdt-extension-for-postgres-19dd4ebad247eefd.md): Supabase · 2022-12-10 · Easy · 7 min read · PostgreSQL, Consistency models, Local-first & sync, Real-time systems
  pg\_crdt is an experimental, open-source Postgres extension that adds CRDT column types (wrapping the Yjs and Automerge Rust libraries via pgx), so a column like a post's content can be a Yjs Doc whose updates are commutative and idempotent.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
