Production Ready. Full type coverage.
Designed for production use, with comprehensive type definitions across the entire API surface.
Rut.ts provides a comprehensive and battle tested set of functions for working with Chilean RUT values.
Designed for production use, with comprehensive type definitions across the entire API surface.
Production-grade reliability, with 394 test cases covering the 9 core functions.
Lightweight and fast by design. Optimized for frontend workloads and compatible with Bun, Node, Edge, and the browser.
Zero dependencies and pure TypeScript. Rut.ts behaves identically on Node, Deno, and Bun, at the Edge and on Vercel Functions, and inside any frontend framework — React, Next.js, Astro, or vanilla in the browser.
Add the package with your manager of choice: npm install rut.ts — also works with bun, pnpm, and yarn.
Pull in only what you need: import { validate, format } from 'rut.ts'. Fully typed and tree-shakeable.
Call validate('12.345.678-5') to check a RUT, or format('123456785') to clean it up. Strict and safe (non-throwing) modes included.
Zero dependencies, zero config. The same code runs on Node, Deno, Bun, the Edge, and the browser.
From verifier-digit math to live input formatting — each function does one job well, so you compose only what you need.
The RUT (Rol Único Tributario) is Chile's unique identification number, used for tax purposes, legal identification, government services, and banking. It's written as XX.XXX.XXX-Y — a 7–8 digit body followed by a single verifier digit (0–9 or K). For example: 12.345.678-5.
That final character is a check digit derived from the body using the Modulo 11 algorithm, which is what lets a RUT be validated for authenticity without contacting any registry. Computing and verifying it correctly is exactly what rut.ts handles for you.
The blog covers the engineering behind rut.ts — how validation, formatting, and manipulation actually work, and the trade-offs behind the API.
Liking rut.ts?
Star on GitHubMIT License © 2026 Arrow Software