Skip to content

Handle 🇨🇱 RUT values with ease using TypeScript.

Rut.ts provides a comprehensive and battle tested set of functions for working with Chilean RUT values.

Execution time

<1ms

Ultra Lightweight

~1.4 KB1

License

MIT

Complete. Secure. Reliable.

Production Ready. Full type coverage.

Designed for production use, with comprehensive type definitions across the entire API surface.

Small core. Heavily tested.

Production-grade reliability, with 394 test cases covering the 9 core functions.

Lightning fast. Run everywhere.

Lightweight and fast by design. Optimized for frontend workloads and compatible with Bun, Node, Edge, and the browser.

Runs everywhere your TypeScript or JavaScript runs

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.

Node.js
Bun
React
Astro
Node.js
Bun
React
Astro
Deno
TypeScript
Next.js
Vercel
Deno
TypeScript
Next.js
Vercel

Get started in seconds

1

Install the library

Add the package with your manager of choice: npm install rut.ts — also works with bun, pnpm, and yarn.

2

Import the function(s)

Pull in only what you need: import { validate, format } from 'rut.ts'. Fully typed and tree-shakeable.

3

Use the function(s)

Call validate('12.345.678-5') to check a RUT, or format('123456785') to clean it up. Strict and safe (non-throwing) modes included.

4

Ship anywhere. Enjoy!

Zero dependencies, zero config. The same code runs on Node, Deno, Bun, the Edge, and the browser.

Built lean,
battle tested;
ready for your use cases

From verifier-digit math to live input formatting — each function does one job well, so you compose only what you need.

FAQs

  • 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.

Go deeper on rut.ts.

The blog covers the engineering behind rut.ts — how validation, formatting, and manipulation actually work, and the trade-offs behind the API.

rut.ts

MIT License © 2026 Arrow Software