Skip to content

China ID Card中国身份证号码验证工具库

基于 GB 11643-1999 国家标准 · 0 依赖 · TypeScript · 15/18 位全兼容

China ID Card ValidatorChina ID Card Validator

30 秒上手 ​

bash
pnpm add china-id-card
bash
npm install china-id-card
bash
yarn add china-id-card
typescript
import { isValid, parse, mask } from 'china-id-card';

// 快速验证
isValid('622922197808118498'); // → true

// 解析完整信息
const info = parse('622922197808118498');
// → { isValid: true, province: '甘肃省', birthDate: '1978-08-11',
//     gender: 'male', age: 46, ... }

// 脱敏处理
mask('622922197808118498'); // → '622***********8498'

不想安装?直接进入在线体验,在浏览器里试用全部功能。

基于 GB 11643-1999 标准