Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Zod · Module

.gte

.gte(value) adds an inclusive minimum constraint to a Zod number schema. Inputs below the supplied threshold fail validation, while the threshold and larger values are accepted.

How it works

.gte(value) adds an inclusive lower-bound check to a numeric Zod schema. Parsing succeeds when the input is at least the supplied value and fails with a validation error when it is smaller.

Syntax

z.number().gte(value)

Parameters

NameTypeDescription
valuenumberThe inclusive minimum numeric value accepted by the schema.

Returns

A Zod number schema with an inclusive lower-bound validation check.

Key points

  • Use .gte() as a refinement on a numeric schema, such as z.number().gte(18).
  • The method participates in Zod's TypeScript-first schema validation workflow.
  • This card targets the current stable Zod 4 documentation rather than archived versioned documentation.

Example: Minimum-inclusive number validation

import { z } from "zod";

const schema = z.number().gte(18);

console.log(schema.parse(21)); // 21
// schema.parse(17); // throws a ZodError

Creates a number schema that accepts values greater than or equal to 18.

When to use it

Minimum age validation

Accept ages only from adulthood onward.

Numeric range boundaries

Reject measurements below a permitted floor.

Input constraints

Validate counts that cannot be negative or too small.

Interview questions

QWhat does Zod's .gte() method do?

.gte() defines a minimum numeric value that is inclusive. A schema such as z.number().gte(18) accepts 18 and larger numbers, while smaller values fail validation.

Follow-up: How would you require a value strictly above 18? Use .gt(18) instead of .gte(18).

QIs the .gte() boundary inclusive?

It is a numeric constraint applied to a number schema. The parsed input must satisfy the lower bound, otherwise parsing reports a validation failure.

Follow-up: How can the same lower bound be expressed with a range-style API? Use the numeric schema's minimum constraint when available in the documented API.

QHow would you test a .gte() constraint?

Yes. The method name represents greater-than-or-equal-to behavior, so the exact threshold is valid. This differs from .gt(), whose threshold is invalid.

Follow-up: What should be tested at minimum? Test one value below the threshold, the threshold itself, and one value above it.

  • z.number
  • gt
  • lte
  • lt
  • int
  • positive
  • nonnegative

Source: Defining schemas. Checked 2026-10-15.