After a year of active development: Zod 4 is now stable! It's faster, slimmer, more tsc-efficient, and implements some long-requested features. ❤️Huge thanks to Clerk, who supported my work on Zod 4 through their extremely generous OSS Fellowship. They were an amazing partner throughout the (much longer than anticipated!) development process. To simplify the migration process both for users and Zod's ecosystem of associated libraries, Zod 4 is being published alongside Zod 3 as part of the zod@3.25 release. To upgrade: Then import Zod 4 from the "/v4" subpath: import { z } from "zod/v4"; Refer to the Migration guide for a complete list of breaking changes. This page covers the new features and improvements. Zod v3.0 was released in May 2021 (!). Back then Zod had 2700 stars on GitHub and 600k weekly downloads. Today it has 37.8k stars and 31M weekly downloads (up from 23M when the beta came out 6 weeks ago!). After 24 minor versions, the Zod 3 codebase had hit a ceiling; the most commonly requested features and improvements require breaking changes. Zod 4 fixes a number of long-standing design limitations of Zod 3 in one fell swoop, paving the way for several long-requested features and a huge leap in performance. It closes 9 of Zod's 10 most upvoted open issues. With luck, it will serve as the new foundation for many more years to come. For a scannable breakdown of what's new, see the table of contents. Click on any item to jump to that section. You can run these benchmarks yourself in the Zod repo: $ git clone git@github.com:colinhacks/zod.git $ cd zod $ git switch v4 $ pnpm install Then to run a particular benchmark: $ pnpm bench string runtime: node v22.13.0 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p999 ------------------------------------------------- ----------------------------- • z.string().parse ------------------------------------------------- ----------------------------- zod3 363 µs/iter (338 µs … 683 µs) 351 µs 467 µs 572 µs zod4 24'674 n...
First seen: 2025-05-19 15:55
Last seen: 2025-05-19 21:56