Guide · Chile utilities
Chile RUT validation API: check digit, format and batches as JSON for your code and your AI agents
How to validate Chilean RUT numbers from your code or an AI agent: check the verification digit with the modulo 11 algorithm, accept formats with and without dots, compute the check digit when you only have the body and validate whole lists. With Better Llama's MCP tool, no key or sign-up, and no personal data lookups.
What does validating a RUT mean?
The RUT (Rol Único Tributario, Chile's tax ID) has a numeric body and a check digit (DV, dígito verificador) from 0 to 9 or the letter K: in 12.345.678-5, the body is 12345678 and the check digit is 5. The check digit is computed from the body with the modulo 11 algorithm, so validating a RUT means checking that the written digit matches the computed one. That catches most typos in forms, spreadsheets and databases.
Validating is not verifying: a RUT with a correct check digit may not exist or may not belong to whoever typed it. Our tool chile_calendar_and_rut, with operation validar_rut, does the calculation locally: it does not query the SII (Chile's tax authority) or any database, and it returns no names. In the query of Monday, November 23, 2026 at 14:19 (Chile time), 12.345.678-5 came back with "valid": true and the normalized format.
The same tool computes public holidays and business days; that is covered in the Chile public holidays API guide. This guide focuses on the RUT: the algorithm, formats, errors, batches and privacy.
How the check digit is computed (modulo 11)
- Take the digits of the body from right to left.
- Multiply each one by the weights 2, 3, 4, 5, 6 and 7; after 7, start again at 2.
- Add up the products and take the remainder of dividing the sum by 11.
- Subtract that remainder from 11. If the result is 11, the check digit is 0; if it is 10, the check digit is K; otherwise, it is that number.
Example with the body 12.345.678:
| Digit × weight (right to left) | Product |
|---|---|
| 8 × 2 | 16 |
| 7 × 3 | 21 |
| 6 × 4 | 24 |
| 5 × 5 | 25 |
| 4 × 6 | 24 |
| 3 × 7 | 21 |
| 2 × 2 | 4 |
| 1 × 3 | 3 |
| Sum | 138 |
The sum is 138; 138 divided by 11 leaves a remainder of 6, and 11 − 6 = 5. That is why the full RUT is 12.345.678-5.
The same algorithm in Python, with no dependencies:
def check_digit(body: int) -> str:
total, weight = 0, 2
for d in reversed(str(body)):
total += int(d) * weight
weight = 2 if weight == 7 else weight + 1
rest = 11 - total % 11
return "0" if rest == 11 else "K" if rest == 10 else str(rest)
for body in (12345678, 80808080, 99887766):
print(body, check_digit(body))Real output:
12345678 5
80808080 K
99887766 0If you only need to validate a field in your form, this function is enough. The API pays off when an AI agent does the validation, when you want the same result in all your systems (with the normalized format and a clear error message) or when you validate whole lists in a single call. In a form, validate when the user leaves the field (not only on submit) and announce the error to screen readers, for example with role="alert".
Step by step: validate RUTs by API
Step 1. Choose the operation
Use operation validar_rut and put the RUTs in ruts, as text. If you only have the body and want the check digit, add rutBodyOnly true.
Step 2. Connect the MCP server
Use the MCP https://mcp.betterllama.com/mcp in your client (configuration below) or call it over HTTP with JSON-RPC. No key or sign-up is needed during the beta.
Step 3. Call the tool
With curl:
curl -s https://mcp.betterllama.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "chile_calendar_and_rut", "arguments": {"operation": "validar_rut", "ruts": ["12.345.678-5"]}}}'Real, complete response (November 23, 2026, 14:19 Chile time):
{
"tool": "chile_calendar_and_rut",
"count": 1,
"results": [
{
"kind": "rut",
"input": "12.345.678-5",
"valid": true,
"body": 12345678,
"dv": "5",
"expectedDv": "5",
"normalized": "12345678-5",
"formatted": "12.345.678-5",
"personType": "persona_natural"
}
],
"warnings": [],
"stopReason": "completed",
"attribution": "Calculado por Better Llama a partir de leyes de feriados y la División Político-Administrativa publicadas por el Estado de Chile.",
"source": "https://betterllama.com/",
"retrievedAt": "2026-11-23T17:19:53.594Z"
}In Python, validate the RUTs that arrive from a web form:
import json
import requests
URL = "https://mcp.betterllama.com/mcp"
HEADERS = {"Accept": "application/json, text/event-stream"}
def validate_ruts(ruts):
body = {"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": "chile_calendar_and_rut",
"arguments": {"operation": "validar_rut", "ruts": ruts, "maxItems": 1000}}}
resp = requests.post(URL, json=body, headers=HEADERS, timeout=60)
resp.raise_for_status()
return json.loads(resp.json()["result"]["content"][0]["text"])["results"]
# Example RUTs, as they would arrive from a web form
form = ["12.345.678-5", "123456785", "12.345.678-9", "80.808.080-k", "ABC-1"]
for r in validate_ruts(form):
if r["valid"]:
print("OK ", r["input"], "->", r["formatted"])
else:
print("REJECT ", r["input"], "->", r["error"])Real output (November 23, 2026, 14:20 Chile time). Error messages come in Spanish:
OK 12.345.678-5 -> 12.345.678-5
OK 123456785 -> 12.345.678-5
REJECT 12.345.678-9 -> dígito verificador incorrecto
OK 80.808.080-k -> 80.808.080-K
REJECT ABC-1 -> formato inválido (esperado 12.345.678-5)In JavaScript (Node.js 18 or later, as an .mjs module), compute the check digit from the body:
const URL = "https://mcp.betterllama.com/mcp";
async function computeDv(bodies) {
const resp = await fetch(URL, {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream" },
body: JSON.stringify({
jsonrpc: "2.0", id: 1, method: "tools/call",
params: { name: "chile_calendar_and_rut",
arguments: { operation: "validar_rut", ruts: bodies, rutBodyOnly: true } },
}),
});
const data = await resp.json();
return JSON.parse(data.result.content[0].text).results;
}
for (const r of await computeDv(["12345678", "80808080", "99887766"])) {
console.log(r.body, "DV", r.expectedDv, r.formatted, r.personType);
}Real output:
12345678 DV 5 12.345.678-5 persona_natural
80808080 DV K 80.808.080-K persona_juridica
99887766 DV 0 99.887.766-0 persona_juridicaStep 4. Use the result
Each RUT comes back with input (what you sent), valid, body, dv (the written or computed check digit), expectedDv and personType. Valid ones also include normalized (no dots, with a hyphen, like 12345678-5), ideal for storing in your database, and formatted (with dots, like 12.345.678-5), for display. Invalid ones include error.
Accepted formats: with dots, without dots and without a hyphen
The tool accepts the RUT with dots and hyphen, with a hyphen only or all together (the last character is taken as the check digit), and K in upper or lower case. Real results of a single call with seven example RUTs:
| Input | valid | Result (formatted or error) |
|---|---|---|
12.345.678-5 | true | 12.345.678-5 |
12345678-5 | true | 12.345.678-5 |
123456785 | true | 12.345.678-5 |
12.345.678-9 | false | dígito verificador incorrecto |
11.111.111-1 | true | 11.111.111-1 |
80.808.080-k | true | 80.808.080-K |
99.887.766-0 | true | 99.887.766-0 |
The first three are the same RUT written three ways: all three come back with the same normalized. The lower-case k comes back in upper case.
Common errors and what the API returns
When a RUT is not valid, the response explains why in error (in Spanish). Real results:
| Input | valid | Result (formatted or error) |
|---|---|---|
12.345.678 | false | dígito verificador incorrecto |
ABC-1 | false | formato inválido (esperado 12.345.678-5) |
0-0 | false | cuerpo inválido |
1234567890-1 | false | formato inválido (esperado 12.345.678-5) |
Watch the first one: 12.345.678 with no hyphen or check digit is read as body 1,234,567 with check digit 8, and the expected digit for that body is 4. If your data only has the body, use rutBodyOnly true and the tool computes the check digit instead of rejecting it.
If you call validar_rut without RUTs, the tool returns an error (isError) with the message "validar_rut" requiere al menos un RUT en "ruts".
Validate batches of RUTs in one call
You can send up to 5,000 RUTs per call, but the response holds at most maxItems results: 50 by default and up to 1000. In a real test with 120 example bodies and no maxItems, the response had 50 results and "stopReason": "maxItems"; with "maxItems": 1000 it had all 120 and "stopReason": "completed".
- For lists of more than 1000 RUTs, split them into blocks of 1000 and check
stopReasonin each response. - Repeated RUTs with the same text come back once: 3 entries (
12.345.678-5twice and12345678-5) gave 2 results. To match them with your rows, useinput. - The beta limit is 60 requests per minute per IP; a batch in a single call counts as one request.
Privacy: what the tool does not do
Validation is only a calculation: it does not query the SII, the Civil Registry or any other source, it returns no names or addresses and it does not store the RUTs you send. The personType field is an approximate rule on the number, not a lookup: bodies below 50,000,000 are marked persona_natural (individual) and the rest persona_juridica (legal entity).
Individuals' RUTs are personal data under Chilean law (Laws 19.628 and 21.719). That is why every RUT in this guide is an example, and why our other tools omit individuals' data.
Validate RUTs from your AI agent (MCP)
Add the Better Llama MCP server to your client (Claude, Cursor, VS Code or any other with remote MCP). One MCP brings chile_calendar_and_rut and the rest of the catalog, with no sign-up during the beta.
{
"mcpServers": {
"better-llama": {
"url": "https://mcp.betterllama.com/mcp"
}
}
}claude mcp add --transport http better-llama https://mcp.betterllama.com/mcpSetup for Claude, Codex, Gemini CLI, Windsurf, VS Code and other clients: connect your agent.
Ready-to-run Python and Node.js examples, with config files for each client: examples repository on GitHub.
Then ask, for example: "Check this column of RUTs and tell me which ones have a wrong check digit." or "Compute the check digit for these RUT bodies and return them with dots and hyphen." The agent calls the tool instead of doing the arithmetic from memory, which is where models often get it wrong.
Beta: free and with no sign-up while we test the service.
Pricing
Free during the beta, no sign-up, with a limit of 60 requests per minute per IP. If paid plans come later, we will announce them first on betterllama.com.
Frequently asked questions
How is a Chilean RUT validated?
The check digit is computed from the body with the modulo 11 algorithm and compared with the written digit. If they match, the RUT is valid. With Better Llama you do it by API with chile_calendar_and_rut and operation validar_rut, with no key.
Is there a free API to validate RUTs?
Yes. The chile_calendar_and_rut tool on the Better Llama MCP validates RUTs for free during the beta, with no sign-up, over MCP or JSON-RPC, with a limit of 60 requests per minute per IP.
Does validating a RUT confirm it exists or who owns it?
No. Validation only checks that the check digit is correct. It does not query the SII or any database and returns no names.
Which formats are accepted?
With dots and hyphen (12.345.678-5), with a hyphen only (12345678-5) or all together (123456785), with K in upper or lower case. If you only have the body, use rutBodyOnly true.
How do I compute a RUT check digit?
Send the body in ruts with rutBodyOnly true and read expectedDv and formatted in the response. You can also use the Python function in this guide, which applies the same algorithm.
How many RUTs can I validate per call?
Up to 5,000 RUTs per call, with up to 1000 results per response depending on maxItems (50 by default). For bigger lists, split them into blocks of 1000.
What does personType mean?
It is an approximate rule on the number: bodies below 50,000,000 are marked persona_natural (individual) and the rest persona_juridica (legal entity). It is not a lookup in any registry.
Is Better Llama affiliated with the SII?
No. Better Llama is an independent project, not affiliated with, sponsored by or endorsed by Chile's Servicio de Impuestos Internos or the Government of Chile.
Keep going
- Chile public holidays API guide: 2026 holidays, business days between dates and deadlines with the same tool.
- Chile public procurement API guide: Mercado Público tenders and purchase orders, with filters by buyer RUT.
- Chilean public tenders with your AI agent: use case for government suppliers.
- Chile utilities tool page: parameters, example and FAQ.
Other guides
- Chile open data APIs: official sources by API and MCP — map of the official Chilean sources available by API and MCP, how to find the tool with search_tools, one real call per family and an index of every guide.
- Chile public holidays API: 2026 holidays, business days and RUT — National, regional and local holidays with no key, curl and Python examples, and MCP usage.
- Chile public procurement API: Mercado Público tenders and purchase orders — ChileCompra ticket, curl and Python examples, and MCP usage.
- Chile economic indicators API: UF, dollar, euro, CPI and TPM — One real call per indicator (UF, dollar, euro, UTM, CPI, TMC, TIP, TPM, Imacec, GDP, unemployment and real exchange rate), from the CMF or the Central Bank, with curl, Python, JavaScript and MCP.
- Chile UF API: the Unidad de Fomento value as JSON — today's UF, full month, next month's days already published, range or year, with CMF data and a Central Bank cross-check, curl, Python and JavaScript examples, and MCP usage.
- Chile USD/CLP exchange rate API: the observed dollar as JSON — today's rate, daily series by month, range or year and the warning for values published in advance, with CMF data, curl, Python and JavaScript examples, and MCP usage.
- Central Bank of Chile API: BDE series as JSON — dollar, UF, policy rate, CPI, Imacec, GDP, unemployment and any series by code, series search, curl, Python and JavaScript examples, and MCP usage.
- Chile CMF API: UF value, dollar, UTM and maximum conventional rate — the seven API CMF Bancos series with no API key to request, curl and Python examples, and MCP usage.
- Chile fuel prices API: gasoline 93, 95, 97, diesel and LPG from Bencina en Línea — CNE data with no sign-up, the cheapest by comuna or near a point, curl, Python and JavaScript examples, and MCP usage.
- Chilexpress API: coverage by comuna, shipping quotes and tracking — covered comunas and sectors with their code and no key, names that differ from the official ones, quotes and tracking with your free keys, and MCP usage.
- Chile earthquakes API: latest quake, magnitude, depth and alerts — Public-domain USGS data with Chile local time, no USGS key, curl and Python examples, and MCP usage.
- Chile Official Gazette API: laws, decrees and new companies — Laws, decrees, notices and company incorporations with CVE and official PDF, no key, curl and Python examples, and MCP usage.
- Chile electricity market API: marginal cost, generation and demand — Coordinador Eléctrico Nacional grid data with no user_key to request, curl and Python examples, and MCP usage.
- Colombia SECOP II API: public procurement contracts and processes — Open data from datos.gov.co with no key, curl and Python examples, and MCP usage.
- Colombia TRM API: today's TRM and the COP/USD rate — Superintendencia Financiera data via datos.gov.co with no key, curl and Python examples, and MCP usage.
- Peru BCRP API: exchange rate, inflation and rates — BCRPData series with no key, curl and Python examples, and MCP usage.
- Banxico API: Mexico's FIX exchange rate, UDIS and TIIE — Banco de México SIE indicators with no token to request, curl and Python examples, and MCP usage.
- Chile communes API: regions, provinces and CUT codes — all 346 communes with CUT codes, region filters, name search, curl, Python and JavaScript examples, and MCP usage.
- Chile business days API: deadlines and business-day counts — business-day deadlines from a notice date, Saturdays as business days, calendar days, business days per month, regional holidays and edge cases, with curl, Python and JavaScript, and MCP usage.
This guide is also available en español.