Formify Docs

TIN

Format tax IDs with a custom letter-based mask

TIN

The tin formatter applies a custom mask whose placeholders consume alphanumeric characters — designed for tax identifiers and reference numbers that mix letters and digits.

Options

OptionTypeDefaultDescription
maskstring—The mask, e.g. "XX-XXXXXXX".
maskCharstring"X"The placeholder character that consumes alphanumeric input.

Usage

validationSchema: {
  tin: { format: { type: "tin", options: { mask: "XX-XXXXXXX", maskChar: "X" } } },
}

Result

TypedResult
AB1234567AB-1234567

Things to know

  • Unlike mask, every maskChar occurrence consumes letters and digits — use mask with # when only digits are allowed.
  • The dash (and any other non-maskChar characters) are inserted automatically.

On this page