Zod, the TypeScript-first schema validation library, has released version 4 as a stable milestone. The new version delivers performance improvements, reduced bundle size, and updated API including a new simplified, tree-shakable mini package.
Zod v4 introduces a series of changes across three key areas: performance, API design, and tooling support. Benchmarks published by the maintainers show 14x faster string parsing, 7x faster array parsing, and 6.5x faster object parsing compared to Zod 3. These improvements are paired with reductions in TypeScript type instantiation, helping projects compile faster in large codebases.
Another headline feature in this release is the introduction of @zod/mini, a lightweight distribution weighing just ~1.9 KB gzipped, designed for tree-shakable validation in modern frontend applications. One of the core advantages to Zod Mini appears to be the ability for it to tree-shake, which was difficult with the regular version of Zod. To enable this, Zod Mini generally uses wrapper functions instead of methods, so in regular Zod, a developer might use:
import * as z from "zod";
z.string().optional();
Whereas in Zod Mini, the same functionality is achieved using a wrapper function:
import * as z from "zod/mini";
z.optional(z.string());
The mini library is around 6x smaller than the standard Zod v4 package.
API refinements also feature prominently in Zod v4. Format helpers such as z.email()
, z.uuid()
, and z.url()
have been promoted to top-level functions, replacing method calls and improving tree-shaking. Error handling has been unified under a single error parameter, replacing the previous fragmented approach (message, required_error, invalid_type_error).
Developers can also now attach strongly typed metadata to schemas, enabling new workflows such as schema-driven form generation.
Zod v4 further introduces built-in JSON Schema conversion via .toJSONSchema()
, eliminating the need for external libraries to bridge Zod schemas into standardized formats.
For teams upgrading from v3, an unofficial codemod (zod-v3-to-v4) is available to automate common migration tasks. The maintainers have also published a migration guide detailing breaking changes and recommendations for a smoother transition.
Community feedback has highlighted both performance and metadata as standout features. On r/reactjs, one developer noted:
The most exciting thing to me is the addition of custom metadata, which means Zod is now a viable schema type for form generation.
In a video overview, TypeScript educator Matt Pocock emphasized that Zod v4 is not only faster but also commented particularly on the performance of TypeScript due to the lower number of TypeScript instantiations. He also discussed the introduction of @zod/mini, and that having a tree-shakable Zod is so good for the front-end.
Early adopters have expressed enthusiasm for the release. NextJS Weekly described Zod v4 as a monster upgrade,
with developers citing speed, smaller bundles, and extensibility as compelling reasons to migrate.
Zod is an open-source project widely adopted across TypeScript ecosystems for runtime validation, schema inference, and API contracts. To upgrade, developers can head over to the migration guide in the documentation.