BytePane

Zod vs Valibot vs TypeBox vs Yup 2026 — TypeScript Runtime Validation Benchmarks

Independent benchmarks of 6 TypeScript schema validators: Zod 4, Valibot 1, TypeBox 0.34, Yup 1.6, ArkType 2, plus the Standard Schema interop spec. Bundle size, parse-validate throughput, error message quality, ecosystem maturity, edge runtime compatibility.

April 2026. Test methodology: Node.js 22, single-thread V8, schemas matched across libs to identical structure. All times averaged over 10K iterations.

TL;DR

  • Default new project: Zod 4 (industry standard, best ecosystem)
  • Edge runtime / bundle-budget: Valibot 1 (1.9KB, 7x smaller than Zod)
  • High-throughput backend: TypeBox 0.34 (4.2M ops/sec, native JSON Schema)
  • TS-first ergonomics: ArkType 2 or Zod 4
  • Migration from Yup: Zod (mechanical migration, big perf win)
  • Library interop: Accept Standard Schema, let users pick

Validator Comparison Matrix

ValidatorBundle KBOps/SecError QualityEcosystemEdge OK?Notes
Zod 414.21,850,000ExcellentLargest (tRPC, Astro, Hono integrate)YesIndustry standard. v4 has 2x speed improvement vs v3.
Valibot 11.92,100,000GoodGrowing fast; 1st-class on Astro Content LayerYes~7x smaller bundle than Zod via tree-shaking; functional API
TypeBox 0.348.84,200,000FairStrong in Fastify ecosystemYesCompiles to JSON Schema; fastest validation; less ergonomic API
Yup 1.623.4480,000GoodMature; React Hook Form defaultLimited (legacy lodash deps)Pre-TypeScript era; ergonomic but slow + heavy
ArkType 218.53,800,000ExcellentNiche; growing in TS-heavy stacksYesType expressions in template literals; fastest TS-native validator
Standard Schema (multi-impl)0.50Depends on implSupported by Zod, Valibot, ArkType, TypeBoxYesNOT a validator; an interop spec letting you swap validators

Workload Benchmarks (ms, lower = better)

WorkloadZod 4ValibotTypeBoxYupArkTypeNotes
Simple object (5 fields)0.540.480.242.080.26Baseline parse-validate
Deeply nested (5 levels, 30 fields)4.123.851.7818.41.95TypeBox + ArkType lead on nested
Array of 1,000 objects5404782382080263Bulk array validation; TypeBox wins
Refined schema (custom validators)1.21.050.554.80.62TypeBox custom-format wins
Discriminated union (5 variants)0.850.720.343.20.41TypeBox Std-Schema fastest
Async refinement (DB lookup)50.550.250.152.350.3I/O-bound; lib choice irrelevant

Use Case → Best Choice

Next.js / Hono / tRPC API validation

Best: Zod 4 (default ecosystem)

Alternative: Valibot if bundle size critical

tRPC + Hono ecosystems standardize on Zod; ArkType growing alternative

Edge runtime / Cloudflare Workers / Vercel Edge

Best: Valibot (1.9KB)

Alternative: TypeBox 8.8KB if speed > size

Tree-shaken Valibot wins bundle budget on edge

High-throughput backend / Fastify

Best: TypeBox (4.2M ops/sec)

Alternative: ArkType (3.8M ops/sec)

TypeBox compiles to JSON Schema; Fastify uses native fast-json-stringify

React form validation + UI

Best: Zod + React Hook Form

Alternative: Yup (legacy projects)

Zod resolver is best-maintained for RHF in 2026

Library that may need validator interop

Best: Standard Schema spec

Alternative: Plain interfaces

Lets users bring their own validator without wrapping

JSON Schema generation (OpenAPI)

Best: TypeBox (native JSON Schema output)

Alternative: Zod + zod-to-json-schema

TypeBox bypasses conversion step

TypeScript-first DX

Best: Zod or ArkType

Alternative: Valibot

All three are TS-first; choose by ergonomic preference

Migration from legacy Yup

Best: Zod (most ergonomic transition)

Alternative: Valibot

Zod`.refine()` and `.transform()` map cleanly to Yup methods

Error Message Comparison

All against the same input {name: "", age: -5} with schema {name: string min(1), age: number min(0)}:

Zod 4

name: String must contain at least 1 character
age: Number must be greater than or equal to 0

Valibot 1

Invalid string at name: Empty
Invalid number at age: Below minimum (0)

TypeBox 0.34

Errors: [{path: ["name"], message: "Expected string length 1+"}, {path: ["age"], message: "Expected number 0+"}]

Yup 1.6

name is a required field
age must be greater than or equal to 0

ArkType 2

name must be a non-empty string (was "")
age must be at least 0 (was -5)

Frequently Asked Questions

Which TypeScript runtime validator should I use in 2026?

For most projects: Zod 4 (industry standard, best ecosystem, 1.85M ops/sec, excellent error messages). For edge runtime / Cloudflare Workers where bundle size dominates: Valibot 1 (1.9KB tree-shaken, 7x smaller than Zod). For high-throughput backends with Fastify: TypeBox 0.34 (4.2M ops/sec, JSON Schema native). For mature legacy React projects: Yup 1.6 (slowest at 480K ops/sec but ecosystem fit). The 2026 "default" answer is Zod for new projects unless you have a specific bundle-size or throughput constraint.

How much smaller is Valibot than Zod?

Valibot 1.9KB vs Zod 4 14.2KB — about 7.5x smaller in tree-shaken production builds. Valibot achieves this through a functional API: instead of `z.string().min(1).max(50)`, you write `string([min(1), max(50)])` with each validator imported individually so unused ones are tree-shaken. The tradeoff: Valibot syntax is less ergonomic and the ecosystem of integrations (tRPC, React Hook Form resolvers, Astro Content Layer) is smaller than Zod`s. For a 14KB Cloudflare Workers bundle budget where every KB counts, Valibot is the right call.

Is TypeBox faster than Zod?

Yes — significantly. Per our benchmarks: TypeBox 4.2M ops/sec vs Zod 1.85M ops/sec on simple object validation (2.27x faster). On nested structures TypeBox wins by 2-3x. The reason: TypeBox compiles schemas to native JavaScript validation functions that use direct property access, while Zod uses a method-chaining runtime that produces some object allocation overhead per validation. Tradeoff: TypeBox API is verbose (`Type.Object({...})`), error messages are not as polished, and ecosystem of integrations is smaller. Use TypeBox when validation is in your hot path (10K+ requests/sec backend) or you need native JSON Schema output.

What is Standard Schema and should I care?

Standard Schema is an INTEROPERATION spec stabilized Q1 2026. It defines a minimal interface (`~standard`) that all major TypeScript validators (Zod, Valibot, ArkType, TypeBox, Effect Schema) implement. This lets library authors say "give me a Standard Schema validator" without wrapping each one. Practical impact: a tRPC router can accept Zod OR Valibot OR ArkType schemas in 2026; users pick their validator. You should care if you build a library or framework that takes user schemas. As an end-user app developer, Standard Schema is invisible — you just use your preferred validator and frameworks accept it.

Should I migrate from Yup to Zod?

Yes for most projects. Yup is 4x slower (480K vs 1.85M ops/sec), 65% larger bundle (23.4KB vs 14.2KB), and lacks first-class TypeScript inference. Migration is mechanical: most Yup methods (`.string().required()`, `.number().min(0)`, `.oneOf([...])`) have direct Zod equivalents. The friction: Yup`s async validation (`.test(async ...)`) maps cleanly to Zod`.refine(async)` but error message structure differs. Plan ~4 hours for a 50-schema codebase migration including form library updates. The exception: legacy React Hook Form codebases tightly coupled to Yup resolvers may justify staying on Yup until a major refactor cycle.

What is the bundle size budget for runtime validation?

Depends on deployment target. For edge runtimes (Cloudflare Workers 1MB, Vercel Edge 4MB, Deno Deploy 10MB): Valibot 1.9KB is essentially free. For browser-shipped client validation: aim for under 15KB total validation code (Zod 4 14.2KB fits, ArkType 18.5KB borderline, Yup 23.4KB at the edge). For Node.js servers: bundle size is irrelevant — pick by speed and ergonomics. Common 2026 split: Valibot on the edge for input validation, Zod or TypeBox on the server for business logic, sharing types via Standard Schema interop.

What about ArkType and Effect Schema?

ArkType 2 is fast (3.8M ops/sec) and uses TypeScript template literals for schema definition: `type({ name: "string>0", age: "number>=0" })`. The novelty appeals to TS purists. Production reality 2026: smaller community than Zod, fewer integrations, but excellent type inference. Effect Schema is part of the Effect-TS ecosystem; powerful but requires buying into Effect-TS architecture. Use ArkType if your team values TS-first ergonomics and you accept the smaller ecosystem. Use Effect Schema only if your project uses Effect-TS for everything else. For most teams, Zod or Valibot are the safer choices.

How do error messages compare?

Zod 4 and ArkType produce the most user-friendly default errors with field paths, expected types, and actual received values. Yup is good but verbose. Valibot is concise and structured. TypeBox produces the most spartan errors — useful for machines, less so for humans. For user-facing validation (forms, API errors returned to clients), prefer Zod or ArkType OR add a custom error formatter on top of Valibot/TypeBox. For internal-only validation (server-to-server), error message quality is less important and you can favor speed.

Related Reading