TypeScript's smallest, fastest validator. One prompt away.
Speed. Size. Startup.
Three metrics. Zero compromises.
Validation speed
1stCPU instructions per validation · 22 results from 2 other projects' benchmarks
- 1stArkType658123 ns · 8.1M validations a second on our benchmark
- 2ndTypia794 ns2,097
- 3rdValibot1,875 ns5,647
- 4thTypeBox3,207 ns7,832
- 02 more between
- 5thZod2,012 ns10,044
1st of the 5 libraries that ran all 22 resultswatch live ↓
Bundle size
1stkB gzipped · valibot.dev's login form and schemabenchmarks.dev's download
- 1stArkType1.19 kB0.92 kB on Valibot's login form · 27× smaller than Zod
- 2ndTypia1.52 kB
- 3rdajv1.59 kB
- 4thSuperstruct1.77 kB
- 57 more between
- 10thZod24.7 kB, past the end of the axis
1st of the 12 libraries that ran both resultswatch live ↓
Startup
1stCPU instructions to create a schema · 2 results from 2 other projects' benchmarks
- 1stArkType380.69M instructions on our login app · 63× fewer than Zod
- 2ndTypeBox4,273
- 3rdValibot14,801, past the end of the axis
- 4thsury119k, past the end of the axis
- 02 more between
- 5thZod895k, past the end of the axis
1st of the 6 libraries that ran both resultswatch live ↓
past the axis: the bar is cut, the number is exact@ark/aot default build, in all threehow we measured →
Every number on the board, a library a row.
| library | speed | startup | size |
|---|---|---|---|
| ArkType | 658 | 38 | 1.19 kB |
| Typia | 2nd2,097 | — | 2nd1.52 kB |
| Valibot | 3rd5,647 | 3rd14,801 | 5th1.79 kB |
| TypeBox | 4th7,832 | 2nd4,273 | 9th17.6 kB |
| Zod | 5th10,044 | 5th895k | 10th24.7 kB |
| sury | — | 4th119k | — |
| Zod (compiled) | — | 6th1.18M | — |
| ajv | — | — | 3rd1.59 kB |
| Superstruct | — | — | 4th1.77 kB |
| runtypes | — | — | 6th4.94 kB |
| Zod Mini | — | — | 7th5.91 kB |
| Yup | — | — | 8th13.3 kB |
| Effect Schema | — | — | 11th44.6 kB |
| Joi | — | — | 12th53.8 kB |
speed: CPU instructions per validationstartup: CPU instructions to create a schemasize: kB gzipped— didn't run every result that graph averageshow we measured →
Same type. Now it runs.
TypeScript syntax, in a string. Autocomplete, hover types and squiggles as you type — and the inferred type is the one you'd have written.
interface User {
name: string
email: string
age?: number
role: "admin" | "member"
}const const User: Type<{
name: string;
email: string;
role: "admin" | "member";
age?: number;
}>
User = type({
name: "string",
email: "string.email",
"age?": "number.integer >= 0",
role: "'admin' | 'member'"
})two lines TypeScript can't check, now checked
User({ name: "Ada", email: "ada@", age: -1, role: "admin" })email must be an email addressage must be non-negative
Mind the gap.
15×faster than Zod 4, at the median scenario
32 scenarios against Zod 4. 32 wins.
5.3× faster than Zod's own z.compile at the median, too.
- ArkTypeprecompiled
- Zod (compiled)5.3× the time per call
- Valibot13× the time per call
- Zod15× the time per call
- Zod Mini29× the time per call
Where it loses. It isn't the fastest at everything. On the rows that report errors for invalid data, ajv was faster on 8 of 15.
A bar is a library's median scenario. Under it: its closest scenario, its farthest, and how many it was slower on.
- ArkType (precompiled)1×
- ArkType (dynamic)1.05× slower0.89× to 129× · slower in 18/32
- Zod (compiled)5.3× slower1.32× to 208× · slower in 32/32
- Valibot13× slower2.3× to 197× · slower in 32/32
- Zod15× slower3× to 259× · slower in 32/32
- Zod Mini29× slower3× to 288× · slower in 32/32
median of 32 scenarios · times slower than ArkType · shorter is better
ajv is faster where the hot path reports errors: on 8 of 15 such rows.
We raced it against the ahead-of-time compilers (typia, TypeBox, ajv) and the libraries you'd otherwise write schemas with (Zod 4, compiled or not, and Valibot), on the same inputs. On valid data, no other library was faster in more than 1 of 16 valid-data scenarios.
valid-data scenarios is the most any one library beat precompiled ArkType on: ajv on items defaults (1.45×). ArkType was fastest in 15.
was faster on 8 of 15 rows that report errors on invalid data, by 1.66× to 3.2×. If your hot path reports errors, ajv is the one to beat. Rejecting invalid input with a boolean check, ArkType was 1.31× ahead of typia.
// prefer no build step? dynamic ArkType runs the same definitions, as fast as precompiled on valid data in our runs of schemabenchmarks.dev's benchmark
27×smaller than Zod 4, on Valibot's own login form
Ship the checks, not the parser.
Valibot's own login form, messages included: 0.92 kB gzipped. Valibot ships 1.56. Zod ships 25.1.
- ArkType0.92 kBprecompiled · down from 98.1 kB with parser
- Valibot1.56 kB
- Zod Mini5.12 kB
- Zod25.1 kB
Build the fastest validator or the smallest from the same definitions.
Big frontend? The "smallest" preset gzips smaller than Valibot at every scale we measured, 10 to 1,000 Types.
| gzipped production bundle | default | "smallest" | Valibot |
|---|---|---|---|
| our startup benchmark's login app, 1 Type | 1.2 kB | 1.0 kB | 1.7 kB |
| its shop app, 23 Types | 5.1 kB | 3.5 kB | 3.6 kB |
| 10 Types | 4.1 kB | 3.2 kB | 3.4 kB |
| 50 Types | 11.5 kB | 5.4 kB | 5.5 kB |
| 200 Types | 33.7 kB | 11.0 kB | 11.3 kB |
| 1,000 Types | 139 kB | 37.2 kB | 39.5 kB |
// these are other apps than Valibot's login form above, and their schemas have no custom messages or narrows; these results don't carry over to apps of forms, which we measured separately
In our runs of moltar's benchmark, counting instructions per call, "smallest" is 4% slower than Valibot on parseSafe and 2.1-2.6x faster on the other three cases, while Zod 4 is 1.5-7.9x faster than it and the default build 13-46x faster. The options
63×fewer startup instructions than Zod 4, on a login app
Nothing to parse at startup.
A precompiled Type costs nothing to create: it was built when you built. On the same app, that's 70% fewer startup instructions than Valibot.
- ArkType✓ first validation0.69M
- ajv2.7× the instructions1.87M
- Valibot3.4× the instructions2.35M
- Zod Mini16× the instructions11.41M
- Zod63× the instructions43.72M
- Zod (compiled)74× the instructions51.55M
- TypeBox127× the instructions87.94M
Compiling Zod costs it startup. Zod (compiled) ran 51.55M instructions to Zod's 43.72M.
Your type in. Plain JavaScript out.
One plugin from @ark/aot. No parser, no new Function. Your definitions don't change.
vite.config.tsimport { precompile } from "@ark/aot/unplugin"
plugins: [precompile.vite()]const const Shape: Type<{
kind: "circle";
radius: number;
} | {
kind: "square";
side: number;
}>
Shape = type({
kind: "'circle'",
radius: "number > 0"
}).or({
kind: "'square'",
side: "number > 0"
})const check1 = function (data, ctx) { switch(data?.kind) { case "circle": return check2(data) case "square": return check3(data) } return false}
3 helpers
const check2 = function (data, ctx) { for (;;) { if (!((check4(data.radius)))) { break } return true } return false}
const check3 = function (data, ctx) { for (;;) { if (!((check4(data.side)))) { break } return true } return false}
const check4 = function (data, ctx) { return (Number.isFinite(data)) && (data > 0)}
import { type } from "arktype"
const max = Number(process.env.MAX_NAME)
export const Name = type(`string <= ${max}`)Same results. Same messages.
A precompiled validator accepts and rejects what the Type it replaces does, with the same error messages. If @ark/aot can't precompile a definition, the build stops and says what to change:
src/limits.ts:5:21 type(`string <= ${max}`) cannot be precompiled`max` is `Number(process.env.MAX_NAME)` (src/limits.ts:3:7)`process` is a global the build does not readReplace `process.env.MAX_NAME` with a value the build can read, like a literal or a const holding one, or put // @ark-runtime on the line before the definition, so arktype defines it at runtime.
A build takes longer: precompiling moves creating your Types from your program's startup to your build.
We timed an app of 1012 Types: 22 copies of our startup benchmark's SaaS schemas, each Type validating a request in a handler. Each figure is a median, with the plugin rather than without it, on Node 25 with 16 cores.
- A cold production build took 7.3 s rather than 414 ms with Vite 8, 8.2 s rather than 138 ms with esbuild and 20.3 s rather than 5.6 s with Next 16 on Turbopack.
- At 92 Types, the plugin added 1.0 s to Vite's production build, 1.3 s to esbuild's and 2.5 s to Next's, and 256 ms to an edit in Vite's dev server.
A precompiled validator doesn't compose or introspect at runtime.
It validates, asserts and implements Standard Schema as the Type it replaces does, and lacks methods like .and and .extends. The build fails wherever it sees your program rely on what a validator lacks. If you need the whole Type API at runtime, build with runtime: "arktype". Dynamic vs precompiled
Migrate your schemas with one prompt.
Paste once into Claude Code, Codex or Cursor. It installs the skill, converts your schemas, checks types and tests, and wires up @ark/aot.
import { z } from "zod"
const const Item: z.ZodObject<{
sku: z.ZodString;
quantity: z.ZodNumber;
}, z.core.$strip>
Item = z.object({
sku: z.string().min(1).max(32),
quantity: z.number().int().min(1).max(99)
})
const const Order: z.ZodObject<{
status: z.ZodEnum<{
pending: "pending";
paid: "paid";
shipped: "shipped";
}>;
items: z.ZodArray<z.ZodObject<{
sku: z.ZodString;
quantity: z.ZodNumber;
}, z.core.$strip>>;
coupon: z.ZodNullable<z.ZodString>;
total: z.ZodNumber;
}, z.core.$strip>
Order = z.object({
status: z.enum(["pending", "paid", "shipped"]),
items: z.array(const Item: z.ZodObject<{
sku: z.ZodString;
quantity: z.ZodNumber;
}, z.core.$strip>
Item).min(1),
coupon: z.string().length(8).nullable(),
total: z.number().positive()
})
type type Order = {
status: "pending" | "paid" | "shipped";
items: {
sku: string;
quantity: number;
}[];
coupon: string | null;
total: number;
}
Order = z.infer<typeof const Order: z.ZodObject<{
status: z.ZodEnum<{
pending: "pending";
paid: "paid";
shipped: "shipped";
}>;
items: z.ZodArray<z.ZodObject<{
sku: z.ZodString;
quantity: z.ZodNumber;
}, z.core.$strip>>;
coupon: z.ZodNullable<z.ZodString>;
total: z.ZodNumber;
}, z.core.$strip>
Order>import { type } from "arktype"
const const Item: Type<{
sku: string;
quantity: number;
}>
Item = type({
sku: "1 <= string <= 32",
quantity: "1 <= number.integer <= 99"
})
const const Order: Type<{
status: "pending" | "paid" | "shipped";
items: {
sku: string;
quantity: number;
}[];
coupon: string | null;
total: number;
}>
Order = type({
status: "'pending' | 'paid' | 'shipped'",
items: const Item: Type<{
sku: string;
quantity: number;
}>
Item.array().atLeastLength(1),
coupon: "string == 8 | null",
total: "number > 0"
})
type type Order = {
status: "pending" | "paid" | "shipped";
items: {
sku: string;
quantity: number;
}[];
coupon: string | null;
total: number;
}
Order = typeof const Order: Type<{
status: "pending" | "paid" | "shipped";
items: {
sku: string;
quantity: number;
}[];
coupon: string | null;
total: number;
}>
Order.inferMessages you wrote and the libraries that read your schemas carry over. Async refinements and Zod's default error text don't.
What you keep
- a message you wrote
- shown as written, without its path, as Zod's issue.message was
- tRPC, TanStack Form, react-hook-form
- take the Type through Standard Schema, and read the same path and message
- schemas you haven't converted
- a Zod schema works inside an ArkType definition
What it costs
- an async .refine()
- runs after validation: ArkType is synchronous
- Zod's default messages
- ArkType's, like must be an email address