Skip to main content

Zod v4 vs ArkType vs TypeBox vs Valibot: Schema Validation 2026

·PkgPulse Team

Zod v4 is 14x faster than Zod v3 for string parsing, 57% smaller, and closes 9 of its 10 most-upvoted GitHub issues. It now leads not just in ecosystem size (15M+ weekly downloads) but in performance too. ArkType uses TypeScript syntax directly — { name: 'string', age: 'number' } instead of z.object({}) — and consistently benchmarks as one of the fastest validators. Valibot's modular architecture ships under 1KB for simple validation. TypeBox uses JSON Schema as its type system. In 2026, Zod is still the default — but the alternatives have genuine advantages worth knowing.

TL;DR

Zod v4 for almost everything — 15M weekly downloads, ecosystem integrations (tRPC, Hono, React Hook Form, Drizzle), and v4's massive performance improvements eliminate most reasons to switch. Valibot when bundle size is critical (edge functions, mobile web) — modular tree-shaking keeps it under 1KB for simple schemas. ArkType when you want to write TypeScript syntax directly for validation and prefer the fastest possible runtime performance. TypeBox when you need JSON Schema compatibility or are building API tooling that generates/validates OpenAPI specs. For new projects, Zod v4 is the right default.

Key Takeaways

  • Zod v4: 14x faster string parsing, 57% smaller bundle, @zod/mini for tree-shaking, z.interface(), global registry, JSON Schema output
  • Valibot: <1KB gzipped for simple schemas (tree-shakeable modules), excellent TTI, strong edge runtime performance
  • ArkType: TypeScript-syntax validation ('string | number'), fastest runtime benchmarks, large bundle but zero-overhead types
  • TypeBox: JSON Schema-based, AOT/JIT compilation, fastest of all when using compiled validators, ideal for Fastify/API tooling
  • Standard Schema: All four now support the Standard Schema spec — interoperable between frameworks
  • Ecosystem: Zod has the most integrations (tRPC, Hono, Drizzle, React Hook Form, Conform)

The Validation Landscape in 2026

TypeScript validation libraries solve the same problem: define the shape of data at compile time (TypeScript types) AND validate it at runtime (when data comes in from APIs, forms, user input).

The key dimensions that differentiate them:

  • Bundle size: Matters for browser/edge, irrelevant for Node.js servers
  • Runtime performance: Matters for high-throughput APIs
  • API design: How you define schemas
  • Ecosystem: What frameworks and libraries integrate natively
  • TypeScript inference: How well types are inferred from schemas

Zod v4

Package: zod Weekly downloads: 15M+ GitHub stars: 35K Creator: Colin McDonnell

Zod v4 (released August 2025) is a major overhaul that addresses the main criticisms of Zod v3: slow performance, large bundle, slow TypeScript compilation for large schemas.

Installation

npm install zod  # v4 is the current major

What's New in v4

import { z } from 'zod';

// z.interface() — new in v4, for open objects (unknown keys allowed)
const UserSchema = z.interface({
  name: z.string(),
  email: z.string().email(),
});

// Global registry — register schemas with metadata
import { globalRegistry } from 'zod';

globalRegistry.add(UserSchema, {
  id: 'User',
  description: 'A registered user',
  examples: [{ name: 'Alice', email: 'alice@example.com' }],
});

// JSON Schema output — built into v4
import { toJsonSchema } from 'zod/v4/core';

const jsonSchema = toJsonSchema(UserSchema);
// { type: 'object', properties: { name: { type: 'string' }, ... }, required: [...] }

v4 Performance Improvement

Zod v3 → Zod v4 performance:
String parsing:   14x faster
Array parsing:    7x faster
Object parsing:   6.5x faster
Bundle size:      57% smaller (core)
TS compilation:   ~2x faster for large schemas

@zod/mini (Tree-Shakeable)

npm install zod  # @zod/mini is included
// @zod/mini — 1.9 KB gzipped, functional API
import { string, object, email, minLength, parse } from 'zod/v4/mini';

const schema = object({
  name: string([minLength(2)]),
  email: string([email()]),
});

parse(schema, { name: 'Alice', email: 'alice@example.com' });

Core Zod v4 API

import { z } from 'zod';

// Object schema
const UserSchema = z.object({
  id: z.string().uuid(),
  name: z.string().min(2).max(100),
  email: z.string().email(),
  age: z.number().int().min(0).max(150).optional(),
  role: z.enum(['admin', 'user', 'moderator']),
  createdAt: z.date(),
});

// Infer TypeScript type
type User = z.infer<typeof UserSchema>;

// Parse (throws on error)
const user = UserSchema.parse(rawInput);

// Safe parse (returns result object)
const result = UserSchema.safeParse(rawInput);
if (result.success) {
  const user = result.data;  // User
} else {
  console.log(result.error.issues);
}

Ecosystem

Zod's ecosystem is unmatched — it's the de facto validation standard for the Node.js ecosystem:

  • tRPC: Input/output schema definition
  • Hono: @hono/zod-validator middleware
  • React Hook Form: @hookform/resolvers/zod
  • Conform: Form library with Zod integration
  • Drizzle: Schema creation from Zod schemas
  • OpenAPI: @asteasolutions/zod-to-openapi
  • Prisma: zod-prisma-types generator

Valibot

Package: valibot Weekly downloads: 2M+ GitHub stars: 6.5K Creator: Fabian Hiller

Valibot's core innovation is modular tree-shaking. Instead of importing a class with methods (z.string().email()), you import individual functions (string([email()])). This means only the validators you actually use get bundled.

Installation

npm install valibot

API Design

import * as v from 'valibot';

// Functional, modular API
const UserSchema = v.object({
  id: v.string([v.uuid()]),
  name: v.string([v.minLength(2), v.maxLength(100)]),
  email: v.string([v.email()]),
  age: v.optional(v.number([v.integer(), v.minValue(0)])),
  role: v.picklist(['admin', 'user', 'moderator']),
});

type User = v.InferOutput<typeof UserSchema>;

// Parse
const user = v.parse(UserSchema, rawInput);

// Safe parse
const result = v.safeParse(UserSchema, rawInput);

Bundle Size Advantage

# For a form with email + password validation:
Zod v4 (core):     ~12 KB gzipped
Zod v4 (@zod/mini): ~1.9 KB gzipped
Valibot:           <1 KB gzipped (only the validators used)

Valibot's modular approach pays off when you only need a small subset of validations. For a login form (email + minLength), Valibot might bundle 400 bytes vs Zod's 1.9KB.

When Valibot Wins

// Edge runtime with 1MB script limit (Cloudflare Workers):
// Every KB matters — Valibot's tree-shaking helps

// Mobile web with poor connections:
// Smaller initial parse = better TTI

// Simple validation in a utility function:
// Don't need Zod's full ecosystem for one schema

ArkType

Package: arktype Weekly downloads: 400K GitHub stars: 5K Creator: David Blass

ArkType uses TypeScript syntax for validation — you write 'string | number' instead of z.union([z.string(), z.number()]). It has the fastest runtime benchmarks of any TypeScript validation library.

Installation

npm install arktype

TypeScript-Syntax API

import { type } from 'arktype';

// Write TypeScript type syntax directly
const User = type({
  name: 'string > 2',        // string with min length 2
  email: 'string.email',     // email validation
  age: 'number.integer >= 0',
  role: '"admin" | "user" | "moderator"',
});

type User = typeof User.infer;  // TypeScript type

// Parse
const user = User(rawInput);
if (user instanceof type.errors) {
  console.log(user.summary);  // Error summary
} else {
  // user is User
}

Performance

ArkType uses JIT compilation — schemas are compiled to optimized validation functions on first use:

Runtime benchmarks (object with 5 fields):
ArkType:   ~8M ops/sec
TypeBox:   ~6M ops/sec (compiled)
Valibot:   ~4M ops/sec
Zod v4:    ~2M ops/sec
Zod v3:    ~300K ops/sec

ArkType Limitations

  • Larger bundle than Valibot (the parser for TypeScript syntax adds weight)
  • Smaller ecosystem (fewer framework integrations than Zod)
  • Learning curve: type string syntax has edge cases

TypeBox

Package: @sinclair/typebox Weekly downloads: 8M+ GitHub stars: 4.5K Creator: Sinclair Turner

TypeBox uses JSON Schema as its type system. Every TypeBox schema is a valid JSON Schema object, making it ideal for API tooling that needs to generate OpenAPI specs or validate JSON Schema.

Installation

npm install @sinclair/typebox

JSON Schema-Based API

import { Type, type Static } from '@sinclair/typebox';

const UserSchema = Type.Object({
  id: Type.String({ format: 'uuid' }),
  name: Type.String({ minLength: 2 }),
  email: Type.String({ format: 'email' }),
  age: Type.Optional(Type.Integer({ minimum: 0 })),
  role: Type.Union([
    Type.Literal('admin'),
    Type.Literal('user'),
    Type.Literal('moderator'),
  ]),
});

type User = Static<typeof UserSchema>;

// TypeBox schema IS a JSON Schema object:
console.log(JSON.stringify(UserSchema, null, 2));
// Valid JSON Schema that you can send to any JSON Schema validator

Compiled Validation (Fastest)

import { TypeCompiler } from '@sinclair/typebox/compiler';

// AOT compile the schema (do once at startup)
const compiledUser = TypeCompiler.Compile(UserSchema);

// Subsequent validations are extremely fast
if (compiledUser.Check(rawInput)) {
  // rawInput is typed as User
} else {
  const errors = [...compiledUser.Errors(rawInput)];
}

Use with Fastify

TypeBox is built into Fastify's schema system:

import Fastify from 'fastify';
import { Type } from '@sinclair/typebox';

const app = Fastify();

app.post('/users', {
  schema: {
    body: Type.Object({
      name: Type.String(),
      email: Type.String({ format: 'email' }),
    }),
    response: {
      201: Type.Object({
        id: Type.String(),
        name: Type.String(),
      }),
    },
  },
  handler: async (request, reply) => {
    const { name, email } = request.body;  // Typed
    // Fastify validates using the TypeBox JSON Schema automatically
    return reply.status(201).send({ id: 'uuid', name });
  },
});

Feature Comparison

FeatureZod v4ValibotArkTypeTypeBox
Weekly downloads15M2M400K8M
Bundle size~12KB<1KB (modular)~20KB~15KB
Runtime speedFastFastFastestFastest (compiled)
API styleMethod chainFunctionalTS syntaxJSON Schema
EcosystemExcellentGrowingLimitedGood (Fastify)
JSON Schema outputYes (v4)Via pluginNoNative
Edge runtimeGoodBestGoodGood
TS inferenceExcellentExcellentExcellentExcellent

When to Use Each

Choose Zod v4 if:

  • You want the largest ecosystem (tRPC, React Hook Form, Drizzle, Hono)
  • You need JSON Schema output (v4 built-in)
  • You're starting a new project and want the default choice
  • Performance was your concern with Zod v3 — v4 fixes it

Choose Valibot if:

  • Bundle size is critical (edge functions, mobile web, Cloudflare Workers)
  • You need tree-shakeable validation with minimal overhead
  • Simple to moderate schema complexity

Choose ArkType if:

  • You want to write TypeScript syntax for validation (minimal new API to learn)
  • Runtime performance benchmarks matter
  • You like the type-system-as-validation philosophy

Choose TypeBox if:

  • You're using Fastify (built-in integration)
  • You need schemas that are valid JSON Schema objects
  • Building OpenAPI tooling that generates specs from schemas
  • You want AOT-compiled validation for maximum throughput

Compare schema validation package downloads on PkgPulse.

Comments

Stay Updated

Get the latest package insights, npm trends, and tooling tips delivered to your inbox.