npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

validador-clabe

v2.0.0

Published

Valida, genera y desarma CLABEs interbancarias mexicanas con el catálogo de participantes de SPEI de Banxico

Readme

validador-clabe

Valida, genera y desarma cuentas CLABE (Clave Bancaria Estandarizada) de 18 dígitos, con el catálogo de participantes de SPEI de Banco de México.

npm CI License: MIT

  • Revisa longitud, caracteres y dígito verificador.
  • Identifica el banco con el catálogo oficial de Banxico: 97 instituciones, incluidas fintech como Nu, Mercado Pago o Spin by OXXO.
  • Indica si el banco de la CLABE sigue participando en SPEI.
  • Genera CLABEs con su dígito verificador para datos de prueba.
  • Sin dependencias. Funciona con import y require en Node 20 o superior, con tipos de TypeScript.

¿Necesitas también buscar bancos por nombre o rechazar de entrada las CLABEs de bancos que ya no existen? Usa mx-bancos, que trae el mismo catálogo.

Instalación

npm install validador-clabe

Validar

import { validarCLABE } from 'validador-clabe';
// o: const { validarCLABE } = require('validador-clabe');

validarCLABE('012180001234567899');    // true
validarCLABE('012 180 00123456789 9'); // true, acepta espacios y guiones
validarCLABE('012180001234567891');    // false, digito verificador incorrecto

validarCLABE solo revisa la forma y el dígito verificador. No consulta si la cuenta existe.

Extraer información

import { extraerInfo } from 'validador-clabe';

extraerInfo('012180001234567899');
// {
//   clabe: '012180001234567899',
//   codigoBanco: '012',
//   nombreBanco: 'BBVA MEXICO',
//   bancoVigente: true,
//   codigoPlaza: '180',
//   numeroCuenta: '00123456789',
//   digitoVerificador: '9',
//   esValida: true
// }

bancoVigente es false cuando el código de banco ya no aparece entre los participantes de SPEI. Por ejemplo, IXE (032) se fusionó con Banorte: extraerInfo('032180000118359719') da esValida: true, bancoVigente: false y nombreBanco: 'Desconocido'.

extraerInfo lanza un Error si la CLABE no tiene 18 dígitos o trae letras.

Generar CLABEs de prueba

import { generarCLABE, formatearCLABE } from 'validador-clabe';

generarCLABE('012', '180', '00123456789');
// {
//   clabe: '012180001234567899',
//   codigoBanco: '012',
//   nombreBanco: 'BBVA MEXICO',
//   codigoPlaza: '180',
//   numeroCuenta: '00123456789',
//   digitoVerificador: '9',
//   clabeFormateada: '012 180 00123456789 9'
// }

formatearCLABE('012180001234567899'); // '012 180 00123456789 9'

Validar varias

import { validarCLABEs } from 'validador-clabe';

validarCLABEs(['012180001234567899', '012180001234567891', 'abc']);
// [
//   { index: 0, clabe: '012180001234567899', valida: true,  banco: 'BBVA MEXICO', info: { … } },
//   { index: 1, clabe: '012180001234567891', valida: false, banco: 'BBVA MEXICO', info: { … } },
//   { index: 2, clabe: 'abc', valida: false, error: 'La CLABE debe tener 18 dígitos' }
// ]

Bancos

import { buscarBanco, obtenerCatalogoBancos } from 'validador-clabe';

buscarBanco('012');   // por codigo CLABE
buscarBanco('40012'); // por clave SPEI
// { codigo: '012', claveSpei: '40012', nombre: 'BBVA MEXICO', tipo: 'Banca múltiple' }

obtenerCatalogoBancos(); // las 97 instituciones

API

| Función | Devuelve | |---|---| | validarCLABE(clabe) | true si tiene 18 dígitos y el verificador es correcto | | extraerInfo(clabe) | Banco, plaza, cuenta, verificador, esValida y bancoVigente | | generarCLABE(banco, plaza, cuenta) | CLABE con verificador y sus partes | | formatearCLABE(clabe) | 'BBB PPP CCCCCCCCCCC V' | | validarCLABEs(clabes) | Un resultado por CLABE | | buscarBanco(codigo) | Banco por código CLABE o clave SPEI, o null | | obtenerCatalogoBancos() | Todas las instituciones | | infoCatalogo() | Fuente, URL y fecha del catálogo |

Estructura de la CLABE

012 180 00123456789 9
│   │   │           └─ Dígito verificador
│   │   └───────────── Número de cuenta (11 dígitos)
│   └───────────────── Plaza (3 dígitos)
└───────────────────── Banco (3 dígitos)

El dígito verificador se calcula así: cada uno de los primeros 17 dígitos se multiplica por 3, 7, 1, 3, 7, 1…; se suman las unidades de cada producto, y el verificador es (10 - suma % 10) % 10.

Datos

  • Fuente: lista de instituciones que publica Banco de México en su servicio de Comprobante Electrónico de Pago (CEP), es decir, los participantes de SPEI.
  • Fecha del catálogo incluido: 2026-11-19. Hoy son 97 instituciones.
  • Actualización: node scripts/actualizar-catalogo.mjs AAAA-MM-DD regenera src/catalogo.js.

Cambios

Ver CHANGELOG.md.

Apoyo

Proyecto de código abierto mantenido en mi tiempo libre. Si te fue útil y quieres agradecerlo:

Ko-fi Buy Me a Coffee

Licencia

MIT © Gerardo Lucero, ver LICENSE.