Zero Dependencies
No third-party dependencies, under 2KB minzip — secure with zero supply-chain risk
Based on GB 11643-1999 · Zero dependencies · TypeScript · 15/18-digit compatible
pnpm add china-id-cardnpm install china-id-cardyarn add china-id-cardimport { isValid, parse, mask } from 'china-id-card';
// Quick validation
isValid('622922197808118498'); // → true
// Parse full info
const info = parse('622922197808118498');
// → { isValid: true, province: '甘肃省', birthDate: '1978-08-11',
// gender: 'male', age: 46, ... }
// Mask sensitive digits
mask('622922197808118498'); // → '622***********8498'Don't want to install anything? Try every feature in your browser on the Playground.