Overview
Use Zod when the schema runs on a server or the ecosystem integration matters; use Valibot when schemas ship to the browser or a size-constrained runtime. As of 2026-10-01 Zod is at 4.6 and Valibot at 1.5. Zod 4 cut its core from about 12.5 KB to about 5.4 KB gzipped and added Zod Mini, a tree-shakable functional API of about 1.9 KB. Both implement Standard Schema, so tools that accept it work with either.
Comparison
| Dimension | Zod 4 | Valibot 1 |
|---|---|---|
| API | Method chaining: z.string().min(1); top-level z.email(); zod/mini for a functional API | Functions and pipe(string(), minLength(1)) |
| Bundle | Core about 5.4 KB gzipped; Mini about 1.9 KB | Docs report 1.37 KB for a login form versus 15 to 18 KB for regular Zod and about 4 to 7 KB for Zod Mini |
| Tree-shaking | Methods cannot be removed; Mini fixes this | Native |
| Runtime speed | Large gains over Zod 3 | Similar to Zod 4 per Valibot’s docs |
| JSON Schema | Built-in z.toJSONSchema() | Separate converter package |
| Ecosystem | Widest: form resolvers, API frameworks, and LLM SDK helpers target Zod | Smaller, growing |
Pick Zod when
Pick Zod when integrations and familiarity beat bytes.
- Servers, scripts, and CLIs where size is irrelevant.
- LLM structured-output and tool schemas: the OpenAI SDK ships
zodResponseFormatand the Anthropic TypeScript SDK shipszodOutputFormatunderhelpers/zod, andz.toJSONSchema()is built in. See structured-output. - Teams that already know it; hiring and examples assume Zod.
- Use top-level helpers (
z.email()) in Zod 4; the method forms are deprecated.
Pick Valibot when
Pick Valibot when every kilobyte ships to a user.
- Browser forms and libraries that other apps will bundle.
- Edge and serverless functions where cold-start size matters. Workers allow up to 64 MiB uncompressed, so size is rarely a hard limit now, but smaller bundles still start faster.
- Schemas you want tree-shaken to only the validators used.
- Consider Zod Mini first if you want to stay in the Zod ecosystem.
Migrate
Rewrite schemas one by one; field names stay the same and only the API changes. Keep Zod on the server and Valibot in browser-bound code if needed; the libraries do not conflict. Prefer a Standard Schema-aware consumer so validators can be swapped without adapters. See typescript-runtime-validation and react-forms.
FAQ
Should I use Zod or Valibot?
Use Zod 4 when schemas run on a server or ecosystem integrations matter; use Valibot 1 when schemas ship to the browser or a size-constrained runtime. Consider Zod Mini first if you want to stay in the Zod ecosystem.
Is Valibot smaller than Zod?
Yes; Valibot’s docs report 1.37 KB for a login form versus 15 to 18 KB for regular Zod and about 4 to 7 KB for Zod Mini. Zod 4 core is about 5.4 KB gzipped and Zod Mini about 1.9 KB.
Which validation library works best with LLM structured output?
Zod, because the OpenAI SDK ships zodResponseFormat, the Anthropic TypeScript SDK ships zodOutputFormat, and z.toJSONSchema() is built in. Valibot needs a separate converter package for JSON Schema.
Can I use Zod and Valibot in the same project?
Yes; the libraries do not conflict, so keep Zod on the server and Valibot in browser-bound code if needed. Both implement Standard Schema, so Standard Schema-aware tools accept either.