ForHosting KIT · Developer Utilities

China resident ID check digit

Enter 11010519491231002 and get the check character X, so the full resident ID reads 11010519491231002X; or paste all 18 characters to see whether the last one matches. Useful for cleaning sign-up forms and payroll exports. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Id
11010519491231002
You get
Calculation mode
Compute
Input
11010519491231002
Check digit
X
Id
11010519491231002X

The Chinese resident identity card number (居民身份证) is an eighteen-character personal identifier used across banking, telecom, travel, healthcare, and government forms in mainland China. Seventeen digits encode administrative area, birth date, and a sequence number that also encodes sex; the eighteenth character is a check digit derived from ISO 7064 MOD 11-2 so that single mistypes and many garbled strings fail instead of looking like another valid registration. This capability computes that check character from a pure seventeen-digit base, or validates a complete eighteen-character ID and reports whether the stored digit matches the recomputed value.

How the Chinese resident ID check digit is calculated

A mainland Chinese resident identity number is always eighteen characters when written without punctuation. The first seventeen are decimal digits that encode the administrative division code, the birth date as YYYYMMDD, and a three-digit sequence (odd for male, even for female under the usual convention). The eighteenth character is the check digit under ISO 7064 MOD 11-2 as adopted in the national standard for the citizen identity number.

Each of the seventeen positions multiplies its digit by a fixed weight Wi equal to two raised to the power of eighteen minus i, reduced modulo eleven. That produces the well-known weight sequence seven, nine, ten, five, eight, four, two, one, six, three, seven, nine, ten, five, eight, four, two.

The weighted products are summed, the sum is reduced modulo eleven, and the remainder selects the check character from the table one, zero, X, nine, eight, seven, six, five, four, three, two—so remainder two yields X and remainder zero yields one. Equivalently, the check value is twelve minus the sum modulo eleven, then that quantity modulo eleven, with ten written as the letter X.

Validation is the inverse: recompute the character from the first seventeen digits and compare it to the last character, which must be a decimal digit or uppercase X.

Audit resident ID columns in bulk exports

Batch-validate every Chinese resident ID in a payroll CSV or ERP extract and quarantine rows whose check character no longer matches the recomputed value.

How is the Chinese resident ID check digit calculated?

Multiply the first seventeen digits by the weights 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 (2^(18-i) mod 11), take the sum modulo 11, and map the remainder to 1,0,X,9,8,7,6,5,4,3,2. That is ISO 7064 MOD 11-2 with X for ten.

Why can the check character be X?

ISO 7064 MOD 11-2 uses eleven symbols. When the algorithm yields ten, the national standard writes the letter X instead of a second digit so the ID stays eighteen characters long.

What do the first 17 digits of a Chinese ID contain?

They encode the administrative area, the birth date written as year, month and day, and a three-digit sequence number. Under the usual convention that sequence is odd for men and even for women.

Does a correct check character prove the ID is genuine?

No. It only shows that the number is arithmetically well formed. It does not prove that the person exists in civil registries or that the card is still active.

Can I paste an ID that contains spaces or hyphens?

No. Spaces, hyphens, dots and other punctuation are rejected rather than silently removed, so strip the formatting first. A lowercase x at the end is accepted and turned into a capital X.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/enc/china-id

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/enc/china-id \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"11010519491231002"}'
{
  "id": "11010519491231002"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "enc.china_id",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Non-digit bodies, wrong lengths, empty input, and illegal characters are rejected with a clear invalid_input error. Run it free in the browser or call the KIT API; both paths share the same pure modular arithmetic with no network round-trip and no stored registries of living persons.

How the Chinese resident ID check digit is calculated

Because the algorithm is pure integer modular arithmetic with fixed weights, the same seventeen digits always produce the same check character on every platform—browser, Worker, or offline test harness—which is why the capability ships as a tier-A parse engine rather than a model call.

How to compute the check digit or validate a full ID

Send an id field that contains only digits for the body and, when validating, a final character that is a digit or X. Mode validate expects exactly eighteen characters. Empty strings, missing id, invalid mode values, and wrong lengths (for example sixteen or nineteen characters) fail before any weighted sum runs and are not billed. Remember that a passing check digit only proves arithmetic well-formedness under ISO 7064 MOD 11-2—it does not prove the person exists in civil registries or that the document is active. Spaces, hyphens, dots, and other punctuation are rejected as non-ID input with invalid_input so a form never accepts a silently cleaned value—strip formatting in your client if users paste a spaced or hyphenated string. Mode compute is the default: provide exactly seventeen base digits; the engine returns check_digit as a single character zero through nine or X, id as the full eighteen-character number, length eighteen, and algorithm iso7064_mod11_2. The response reports valid true only when the trailing character matches the recomputed expected_check_digit; it always includes base (the first seventeen digits), check_digit as submitted, expected_check_digit, and the canonical id built from base plus expected character. That shape makes it easy to show “you typed X, expected Y” in a KYC or signup UI without a second request. Because the path is pure parse with no clock, random source, or network, the same input always yields the same JSON on the free browser tool and on the API. At $0.002 per successful request you can protect bulk CRM imports, partner file audits, and form gates without negotiating a custom tier.

Where Chinese ID check digits fit real product workflows

Fintech and marketplace onboarding flows that accept mainland Chinese customers often ask for a resident ID early; validating the check digit on blur reduces failed submissions and support tickets without calling a national registry for every keystroke. Payroll, HR, and campus systems that import employee or student CSVs should quarantine rows whose eighteenth character no longer matches, which catches both human edits and off-by-one bugs in upstream generators. Do not treat a passing check digit as proof of legal identity or residency status—it only proves the eighteen-character string is arithmetically well formed under the official Chinese resident ID rule, the same honesty bar you apply to any national-id checksum tool. Telecom, travel, and hospitality portals that accept the ID as a citizen key can block proceed until valid is true and show expected_check_digit when the digit is wrong. Data-quality jobs recompute expected_check_digit for every ID column in an export and flag mismatches before they reach billing or fiscal reporting.

Complete seventeen base digits for fixtures and forms

Take a seventeen-digit base from a test plan or partial record, call compute mode, and store or display the full eighteen-character id with the ISO 7064 MOD 11-2 check character appended.

Validate typed or imported resident IDs at entry

When a signup form, CRM import, or partner API submits eighteen characters, call validate mode and block storage when valid is false, showing expected_check_digit to fix a mistype.

How do I compute the check digit from seventeen digits?

POST mode compute (or omit mode) with id set to exactly seventeen digits. The response includes check_digit (0–9 or X) and id as the full eighteen-character number.

How do I validate an eighteen-character Chinese ID?

POST mode validate with the full eighteen characters. valid is true only when the last character matches expected_check_digit; both the submitted and expected characters are returned.

What does the China resident ID check digit tool cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →