Built-in rules
Every built-in rule, by category. Params go next to rule in a field's rules, and every rule also takes a message. A rule with params per kind lists them by kind. The validation rules guide explains how they run.
Length
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
length | Exact length | string, array | value: integer, at least 0 | |
minLength | Minimum length | string, array | value: integer, at least 0 | |
maxLength | Maximum length | string, array | value: integer, at least 0 | |
notLength | Not this length | string, array | value: integer, at least 0 |
Text
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
graphemes | Exact characters | string | value: integer, at least 0 | Counts characters as people see them, so an emoji is one. |
minGraphemes | Minimum characters | string | value: integer, at least 0 | Counts characters as people see them, so an emoji is one. |
maxGraphemes | Maximum characters | string | value: integer, at least 0 | Counts characters as people see them, so an emoji is one. |
notGraphemes | Not this many characters | string | value: integer, at least 0 | Counts characters as people see them, so an emoji is one. |
words | Exact words | string | locale?: string; value: integer, at least 0 | |
minWords | Minimum words | string | locale?: string; value: integer, at least 0 | |
maxWords | Maximum words | string | locale?: string; value: integer, at least 0 | |
notWords | Not this many words | string | locale?: string; value: integer, at least 0 | |
bytes | Exact bytes | string | value: integer, at least 0 | Counts UTF-8 bytes, e.g. to fit a database column. |
minBytes | Minimum bytes | string | value: integer, at least 0 | Counts UTF-8 bytes, e.g. to fit a database column. |
maxBytes | Maximum bytes | string | value: integer, at least 0 | Counts UTF-8 bytes, e.g. to fit a database column. |
notBytes | Not this many bytes | string | value: integer, at least 0 | Counts UTF-8 bytes, e.g. to fit a database column. |
Content
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
regex | Matches pattern | string | pattern: string; flags?: string | A JavaScript regular expression, without the slashes. |
startsWith | Starts with | string | value: string | |
endsWith | Ends with | string | value: string | |
includes | Contains | string, array | string: value: stringarray: value: string | number | boolean | |
excludes | Does not contain | string, array | string: value: stringarray: value: string | number | boolean |
Format
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
email | string | |||
rfcEmail | Email (RFC 5322) | string | ||
url | URL | string | ||
domain | Domain | string | ||
slug | Slug | string | ||
uuid | UUID | string | ||
ulid | ULID | string | ||
cuid2 | CUID2 | string | ||
nanoid | Nano ID | string | ||
ip | IP address | string | ||
ipv4 | IPv4 address | string | ||
ipv6 | IPv6 address | string | ||
mac | MAC address | string | ||
mac48 | MAC-48 address | string | ||
mac64 | MAC-64 address | string | ||
hexColor | Hex colour | string | ||
hexadecimal | Hexadecimal | string | ||
octal | Octal | string | ||
decimal | Decimal number | string | ||
digits | Digits only | string | ||
base64 | Base64 | string | ||
bic | BIC (SWIFT code) | string | ||
creditCard | Credit card number | string | ||
imei | IMEI | string | ||
isbn | ISBN | string | ||
isrc | ISRC | string | ||
emoji | Emoji | string | ||
hash | Hash | string | types: ("md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b" | "adler32")[], at least 1 |
Date
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
isoDate | ISO date | string, date | Like 2026-10-28 | |
isoDateTime | ISO date and time | string, date | Like 2026-10-28T14:30 | |
isoTime | ISO time | string, date | Like 14:30 | |
isoTimeSecond | ISO time with seconds | string, date | Like 14:30:15 | |
isoTimestamp | ISO timestamp | string, date | Like 2026-10-28T14:30:15.000Z | |
isoWeek | ISO week | string, date | Like 2026-W44 |
Comparison
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
minValue | Minimum | number, date | number: value: numberdate: value: string | |
maxValue | Maximum | number, date | number: value: numberdate: value: string | |
gtValue | Greater than | number, date | number: value: numberdate: value: string | |
ltValue | Less than | number, date | number: value: numberdate: value: string | |
value | Equals | number, date, string, boolean | number: value: numberdate: value: stringstring: value: stringboolean: value: boolean | |
notValue | Does not equal | number, date, string, boolean | number: value: numberdate: value: stringstring: value: stringboolean: value: boolean | |
values | One of | number, date | number: values: number[], at least 1date: values: string[], at least 1 | |
notValues | None of | number, date | number: values: number[], at least 1date: values: string[], at least 1 |
Number
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
integer | Whole number | number | ||
safeInteger | Safe whole number | number | ||
finite | Finite number | number | ||
multipleOf | Multiple of | number | value: number |
File
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
minSize | Minimum size | file | value: integer, at least 0 | In bytes, e.g. 1048576 for 1 MiB. |
maxSize | Maximum size | file | value: integer, at least 0 | In bytes, e.g. 1048576 for 1 MiB. |
size | Exact size | file | value: integer, at least 0 | In bytes, e.g. 1048576 for 1 MiB. |
notSize | Not this size | file | value: integer, at least 0 | In bytes, e.g. 1048576 for 1 MiB. |
mimeType | File type | file | types: string[], at least 1 |
Normalize
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
trim | Trim | string | ||
trimStart | Trim start | string | ||
trimEnd | Trim end | string | ||
toLowerCase | Lowercase | string | ||
toUpperCase | Uppercase | string | ||
normalize | Unicode normalize | string | form?: "NFC" | "NFD" | "NFKC" | "NFKD" | Defaults to NFC. |
toMinValue | Raise to minimum | number | value: number | Replaces a smaller number with the minimum. |
toMaxValue | Lower to maximum | number | value: number | Replaces a larger number with the maximum. |
Form rules
These go in formRules, next to fields. Each one also takes field, the path its error shows on, and message. See the form rules guide.
| Rule | Label | Kinds | Params | Description |
|---|---|---|---|---|
sameAs | Same as | string, number, boolean, date | other: string | Equals another field, e.g. to confirm a password |
differentFrom | Different from | string, number, boolean, date | other: string | Differs from another field, e.g. a new password |
compare | Compare | number, date | op: "lt" | "lte" | "gt" | "gte"; other: string | Less or greater than another field, e.g. an end date after the start |