Skip to main content
Zod Hero Light

What is Zod?

Zod is a TypeScript-first validation library that lets you define schemas and parse data with them. You’ll get back strongly typed, validated results.
import * as z from "zod";

const User = z.object({
  name: z.string(),
});

// some untrusted data...
const input = {
  /* stuff */
};

// the parsed result is validated and type safe!
const data = User.parse(input);

// so you can use it with confidence :)
console.log(data.name);

Key Features

Zero Dependencies

No external dependencies. Works in Node.js and all modern browsers.

Tiny Bundle Size

Core bundle is just 2kb minified and gzipped.

TypeScript-First

Define a schema once and Zod automatically infers the static TypeScript type.

Immutable API

Methods like .check() return a new instance, keeping your schemas immutable.

Works with Plain JS

You don’t need to use TypeScript. Zod works with plain JavaScript too.

Built-in JSON Schema

Convert your Zod schemas to JSON Schema for interoperability.

Get Started

Installation

Install Zod using npm, yarn, pnpm, or bun

Quick Start

Learn the basics with a hands-on tutorial

Primitives

Explore string, number, boolean, and other basic types

Objects

Define complex object schemas with nested structures

Why Zod?

With Zod, you declare a validator once and automatically get:
  • Static type inference - No duplicate type declarations
  • Runtime validation - Catch data errors at runtime
  • Detailed error messages - Know exactly what went wrong
  • Developer-friendly API - Concise, chainable interface
Zod follows the parse, don’t validate philosophy, giving you confidence in your data from input to output.

Build docs developers (and LLMs) love