Zod vs Valibot
Zod vs Valibot compared for 2026: Zod 4.6 (method-chaining schemas with an optional ahead-of-time compiler) vs Valibot 1.5 (small, tree-shakable functions piped together). Includes bundle sizes we built, parse speed on valid and invalid data, schema creation cost, TypeScript check time, JSON Schema output, async pitfalls and when to pick each.
Quick Answer
Zod and Valibot are TypeScript-first schema libraries with the same job: describe the shape of data once, validate unknown input at runtime and infer a static type from the schema. They are built differently. Zod 4.6.7 (12 October 2026) uses schema objects with chained methods such as z.string().email().min(8), and since 4.5 can compile a schema into generated JavaScript for a faster happy path. Valibot 1.5.0 (9 September 2026) uses small standalone functions combined with pipe(), so a bundler keeps only the validators you import. In our runs on 30 November 2026 a login form bundled to 1,497 bytes gzipped with Valibot, 5,111 with Zod Mini and 25,001 with regular Zod. On 100,000 valid objects, Valibot's safeParse took 145-228 ms against 182-321 ms for Zod and 47-84 ms for a compiled Zod schema; on invalid objects Valibot was about 3.5 times faster (260-271 ms against 907-993 ms). Creating schemas was roughly 15 to 20 times cheaper in Valibot. Zod was cheaper for the TypeScript compiler: 200 schemas produced 53,475 type instantiations against 263,390 for Valibot. Zod also ships JSON Schema conversion in the core package and has the larger ecosystem.
Last updated November 30, 2026. Covers Zod 4.6.7 (12 October 2026) and Valibot 1.5.0 (9 September 2026); npm registry metadata, GitHub releases, Zod docs (compile, JSON Schema, Zod Mini, error formatting), Valibot's comparison and Zod migration guides, changelog and to-json-schema README read on 30 November 2026, plus bundle, parse-speed, startup, TypeScript and behaviour runs we did that day.
| Feature | Zod | Valibot |
|---|---|---|
| Licence & Repository | MIT; colinhacks/zod, ~44.5k stars | MIT; open-circle/valibot, ~9.1k stars |
| Latest Release (Nov 2026) | 4.6.7 on 12 Oct 2026 | 1.5.0 on 9 Sep 2026 |
| API Style | Chained methods (classic) or functions (zod/mini) | Standalone functions combined with pipe() |
| Dependencies & Install Size | 0 deps; 840 files, 8.4 MB on disk | 0 deps; 9 files, 1.8 MB on disk |
| Our Run: Login Form Bundle (min / gzip) | 85,018 B / 25,001 B (Zod Mini 14,234 / 5,111) | 3,742 B / 1,497 B |
| Our Run: 10-Field User Schema Bundle (min / gzip) | 97,122 B / 28,039 B (Mini 9,029 gz; with z.compile 35,590 gz) | 8,859 B / 2,841 B |
| Our Run: 100k Valid Objects | 182-321 ms; compiled 47-84 ms | 145-228 ms (v.is 136-149 ms) |
| Our Run: 100k Invalid Objects (Full Errors) | 907-993 ms; compiled 852-1,137 ms | 260-271 ms |
| Boolean-Only Check | z.validate(): 39-68 ms valid, 12-15 ms invalid (compiled) | v.is(): 136-149 ms valid, 35-57 ms invalid |
| Our Run: Build 10k Schemas | 358-386 ms (Mini 224-272 ms) | 18-25 ms |
| Our Run: Import Time (Node.js) | 39-42 ms ESM, 49 ms require | 9-13 ms ESM, 5 ms require |
| Our Run: TypeScript Cost, 200 Schemas | 53,475 instantiations; TS 7.0.2 0.28 s, TS 6.0.3 1.17-1.28 s | 263,390 instantiations; TS 7.0.2 0.53-0.69 s, TS 6.0.3 2.14-2.30 s |
| Code Generation / Compilation | z.compile() and import 'zod/compile' (since 4.5) | None (no new Function by design) |
| Works Without eval / new Function | Yes with z.config({ jitless: true }), slower | Yes, no change needed |
| JSON Schema Output | Built in: z.toJSONSchema(), draft 2020-12 default | @valibot/to-json-schema 1.8.0, draft-07 default |
| Unknown Object Keys (Default) | Stripped; z.strictObject rejects, z.looseObject keeps | Stripped; v.strictObject rejects, v.looseObject keeps |
| Async Schema Used Synchronously | Throws $ZodAsyncError: use parseAsync | Type error in TS; plain JS returned undefined |
| Error Formatting Helpers | z.flattenError, z.treeifyError, z.prettifyError, locales | v.flatten, v.getDotPath, v.summarize, @valibot/i18n |
| Standard Schema Support | Yes (~standard incl. jsonSchema) | Yes (~standard) |
| Release Activity (2026) | 4.3.5 to 4.6.7 (Jan-Oct 2026), 19 releases | 1.3.0 to 1.5.0 (Mar-Sep 2026), 6 releases |
Zod
Zod is the most widely used TypeScript schema library. You build schemas from z.object, z.string, z.array and friends, refine them with chained methods (.min(), .email(), .optional(), .transform()), and get a static type with z.infer. Zod 4 (first published alongside Zod 3 inside the [email protected] release, now the default) rewrote the internals, added Zod Mini (a functional, tree-shakable API at zod/mini, also published as the standalone @zod/mini package since 4.5) and built-in JSON Schema conversion with z.toJSONSchema(). The 2026 releases focused on speed: Zod 4.5.0 (28 August 2026) added z.compile(), which generates flat, loop-free JavaScript for a schema and runs it through new Function as a fast path, plus z.validate() for boolean checks that skip error construction; Zod 4.6.0 (9 September 2026) added the .validate() method, z.iban(), z.withParser() for environments without new Function, and faster CommonJS exports. Zod has no dependencies and implements the Standard Schema interface, so libraries such as form resolvers and API frameworks can accept it without a Zod-specific adapter.
Pros
- Largest ecosystem of the two: 44.5k GitHub stars and the default schema library in many form, API and AI tooling integrations
- Compiled schemas were the fastest option on valid data: 47-84 ms for 100,000 objects against 145-228 ms for Valibot
- z.validate() rejected 100,000 invalid objects in 12-15 ms when only a yes or no answer was needed
- Cheaper for TypeScript: 200 schemas took 0.28 s to check with TypeScript 7 (53,475 instantiations) against 0.53-0.69 s for Valibot
- JSON Schema conversion in the core package, targeting draft 2020-12 by default plus draft-07, draft-04 and OpenAPI 3.0
- Using an async refinement in a synchronous parse throws a clear $ZodAsyncError instead of silently passing
Cons
- Large bundles with the classic API: a two-field login form bundled to 25,001 bytes gzipped (Zod Mini: 5,111)
- Error paths are slow: 100,000 invalid objects took 907-993 ms with full error reporting, and compiling did not help (852-1,137 ms)
- Schema creation is expensive: building 10,000 small schemas took 358-386 ms against 18-25 ms for Valibot
- Its fastest paths depend on new Function; with jitless mode for strict CSP, our simple-object loop slowed from 16-47 ms to 82-112 ms
- Zod Mini, the small-bundle API, was the slowest variant we ran: 341-548 ms on valid objects
Best For
Server-side validation, API and AI tooling where JSON Schema output and integrations matter, large codebases where TypeScript check time adds up, and hot paths that can use z.compile() or validate().
Valibot
Valibot is a modular schema library for TypeScript. Every schema and every check is a separate function: v.object, v.string and v.number are schemas, while v.email, v.minLength and v.regex are actions you combine with v.pipe(v.string(), v.email()). Because nothing hangs off a class with dozens of methods, bundlers can drop whatever you do not import, which is the library's main selling point for client-side code. Valibot reached 1.0 on 18 March 2025 and is now maintained under the open-circle GitHub organisation. Version 1.4.0 (5 May 2026) reduced allocations on hot paths and moved the build target to ES2020; 1.5.0 (9 September 2026) added code-point length checks and a KSUID validator, initialises Standard Schema properties eagerly and uses URL.canParse for url(). JSON Schema conversion lives in the separate @valibot/to-json-schema package (1.8.0), and @valibot/zod-to-valibot is a beta codemod for migrating Zod schemas. Valibot has no dependencies; TypeScript 5 or later is an optional peer.
Pros
- Smallest bundles by far: our login form was 1,497 bytes gzipped and a 10-field user schema 2,841 bytes, about 10 times smaller than classic Zod
- Fast on invalid data: 100,000 objects with five errors each took 260-271 ms with full issues, 35-57 ms with v.is() or abortEarly
- Cheap to start: import took 9-13 ms and building 10,000 schemas 18-25 ms
- No code generation, so it behaves the same under strict Content Security Policy and in edge runtimes
- Consistent functional API where third-party actions are ordinary functions you can write yourself
- Zero dependencies, ES2020 build output, and a codemod for migrating from Zod
Cons
- Heavier on the TypeScript compiler: 200 schemas produced 263,390 type instantiations and took 0.53-0.69 s with TypeScript 7 (Zod 0.28 s)
- No compiler: on valid data a compiled Zod schema was 2-3 times faster (47-84 ms against 145-228 ms)
- Calling v.parse() on an async schema in plain JavaScript returned undefined and safeParse reported success; only the TypeScript types catch it
- JSON Schema output needs a second package and defaults to draft-07
- Smaller ecosystem (9.1k stars, 211 open issues) and some integrations still ship Zod-first examples
Best For
Browser bundles, forms and edge functions where every kilobyte and cold start counts, apps that validate lots of invalid input (user forms, public APIs), and teams that prefer small composable functions.
Two designs: methods on objects versus functions in a pipe
The difference you notice first is syntax. Zod's classic API chains methods: z.object({ email: z.string().min(1).email(), age: z.number().int().optional() }). Valibot passes values through functions: v.object({ email: v.pipe(v.string(), v.nonEmpty(), v.email()), age: v.optional(v.pipe(v.number(), v.integer())) }). The difference that matters is what a bundler can remove. A Zod string schema is an object whose prototype carries every string method, so importing z.string pulls in email, url, uuid, regex and the rest whether you call them or not. Each Valibot action is a separate export, so a schema that uses email and minLength includes only those. Zod's answer is Zod Mini, a functional API at zod/mini (also the standalone @zod/mini package since 4.5) that looks much like Valibot: z.string().check(z.minLength(1), z.email()). The other structural difference is execution. Valibot interprets its pipeline at runtime and deliberately avoids the Function constructor. Zod classic generates specialised code for object parsing at runtime, and since 4.5 z.compile() goes further, generating a flat validator for the whole schema and falling back to the normal parser to build errors. Both expose the Standard Schema interface (~standard), so form libraries, routers and RPC frameworks that accept Standard Schema work with either, and both strip unknown object keys by default with strictObject and looseObject variants for the other behaviours.
What we measured: bundle size, parse speed and startup
We bundled the same schemas with esbuild 0.28.2 (minified ESM, gzip -9) on 30 November 2026. A two-field login form with custom messages: Zod 85,018 bytes minified and 25,001 gzipped, Zod Mini 14,234 and 5,111, Valibot 3,742 and 1,497. A 10-field user schema with a UUID, email, enum, nested object, record, regex and a discriminated union: Zod 28,039 bytes gzipped, Zod Mini 9,029, Valibot 2,841; adding z.compile raised Zod to 35,590. Valibot's own comparison page quotes smaller Zod figures from bundlejs, so expect numbers to vary with bundler and version. Runtime used Node.js 22.23.5 pinned to one core, 100,000 user objects, three runs. On valid data Zod safeParse took 182-321 ms, a compiled Zod schema 47-84 ms, Zod Mini 341-548 ms, Valibot safeParse 145-228 ms and v.is 136-149 ms. On invalid data with five errors per object, Zod took 907-993 ms, compiled Zod 852-1,137 ms because compilation falls back to the normal parser to build errors, Zod Mini 1,245-1,327 ms and Valibot 260-271 ms. Boolean checks were fastest: compiled z.validate 12-15 ms and v.is 35-57 ms on the same invalid objects. Startup favoured Valibot: import in 9-13 ms against 39-42 ms, and 10,000 small schemas built in 18-25 ms against 358-386 ms.
The TypeScript cost nobody benchmarks
Schema libraries run twice: once in production and once inside the TypeScript compiler on every build and every keystroke in the editor. We generated 200 equivalent schemas for each library, nine fields each including a nested object, enum, record and optional number, inferred a type from each and annotated a variable with it. With TypeScript 7.0.2, Zod's file needed 53,475 type instantiations and 0.28 s in total; Valibot's needed 263,390 instantiations and 0.53-0.69 s. With TypeScript 6.0.3, the last JavaScript-based compiler, the totals were 1.17-1.28 s against 2.14-2.30 s, and memory 114-118 MB against 138-139 MB. Valibot's pipe() types carry a tuple of every action, which is precise but makes the checker work harder; the 1.4.0 release notes mention type-performance work on object outputs, so the gap has been narrowing. In a small app neither number matters. In a monorepo with thousands of schemas, or a shared package of API contracts imported everywhere, the difference shows up as slower editor feedback. The types also catch a runtime trap: passing an async Valibot schema to v.parse() is a TS2345 compile error, but in plain JavaScript our call returned undefined and safeParse reported success with no output. Zod throws $ZodAsyncError at runtime in the same situation, so JavaScript-only projects get a louder failure.
JSON Schema, errors and the ecosystem around each
If schemas feed OpenAPI documents, LLM structured outputs or form generators, JSON Schema support matters. Zod includes z.toJSONSchema() in the core package, targets draft 2020-12 by default and can emit draft-07, draft-04 or OpenAPI 3.0. Valibot uses @valibot/to-json-schema 1.8.0, which defaults to draft-07 and supports draft 2020-12 and OpenAPI 3.0. On the same user schema the outputs differed in instructive ways. Zod added regex patterns for uuid and email next to the format keyword, a maximum of 9,007,199,254,740,991 for integers, and additionalProperties: false, which its docs say mirrors the stripping of unknown keys. Valibot emitted only formats and left additionalProperties unset. Both refused to convert a transform, with clear errors. Default error messages differ too: for a number field missing from the input, Zod said 'Invalid input: expected number, received undefined' and Valibot 'Invalid key: Expected "age" but received undefined'. Zod ships z.flattenError, z.treeifyError and z.prettifyError plus many locales; Valibot ships v.flatten, v.getDotPath, v.summarize and translations in @valibot/i18n. Ecosystem size is the clearest gap: Zod has 44.5k stars against Valibot's 9.1k, and many tutorials, SDKs and code generators still show Zod first. Standard Schema support on both sides has made switching libraries far less risky than it was.
Limits, migration and when not to use each
Do not choose classic Zod for a bundle-sensitive client if Valibot or Zod Mini will do; 25 kB gzipped for a login form is hard to justify on a landing page. Do not assume Zod Mini fixes everything: it shrinks bundles but was the slowest parser in our runs, so it suits small client-side forms rather than servers. Do not rely on z.compile() everywhere: it uses new Function, which strict Content Security Policy and some sandboxes forbid. In jitless mode our simple-object loop went from 16-47 ms to 82-112 ms for 300,000 parses, and the compile docs list schemas that are not compiled, including async refinements, recursive schemas and z.coerce. Compiled schemas also do not speed up failures much. Do not pick Valibot if your team will check thousands of schemas in one TypeScript project and editor latency already hurts, or if you depend on a library that only accepts Zod schemas rather than Standard Schema. Migration in either direction is mechanical for common schemas: Valibot publishes the @valibot/zod-to-valibot codemod, marked beta, with a dry-run mode, and its guide maps Zod methods to pipe actions. Coercion is a place to test carefully: both z.coerce.number() and a Valibot string-to-number pipe turned an empty string into 0 in our runs, which is rarely what a form wants. Version notes: Zod 4.6.7 and Valibot 1.5.0 both run on any modern runtime with no dependencies, so neither forces an upgrade elsewhere.
Verdict
Pick Valibot when the schemas ship to the browser or to an edge function: forms, client-side checks of API responses, Cloudflare Workers, anything where bundle size and cold start matter. In our builds it was about 10 times smaller than classic Zod and 3 times smaller than Zod Mini, imported in 9-13 ms, and it handled invalid input three to four times faster with full error details. Pick Zod on the server and in tooling: API validation, AI structured output, code that needs JSON Schema or OpenAPI, and large codebases where TypeScript check time matters, since 200 Zod schemas cost the compiler about a fifth of the type instantiations that Valibot's did. If you validate high volumes of mostly valid data, compile the hot schemas with z.compile(), which was the fastest option we measured, and use .validate() when you only need a boolean. If you already run Zod 4 and bundle size is your only complaint, try zod/mini or @zod/mini first, but measure: it shrank our login bundle from 25 kB to 5 kB and was also the slowest parser we ran. Whichever you choose, keep async checks behind parseAsync and let TypeScript check every call, because Valibot only warns about sync parsing of async schemas at the type level.