Number Validators in Zod

From the Zod cheat sheet ยท Number Validation ยท verified Jul 2026

Number Validators

Range, integer, and sign validators for numbers

typescript
z.number().min(0);
z.number().max(100);
z.number().int();
z.number().positive();
z.number().negative();
z.number().multipleOf(5);
๐Ÿ’ก z.number() rejects NaN by default โ€” use z.nan() if you need to allow it
โšก Use .int() before other validators for cleaner integer-only schemas
๐Ÿ“Œ .multipleOf() works for floats like 0.01 โ€” perfect for currency validation
๐ŸŸข .safe() ensures the number fits in JavaScript safe integer range
numbervalidationinteger
Back to the full Zod cheat sheet