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

cbu

v1.0.0

Published

Lightweight utilities for validating, parsing, and generating Argentine CBU numbers

Downloads

22

Readme

cbu

npm version npm downloads CI License: MIT

Lightweight utilities for validating, parsing, and generating Argentine CBU numbers.

What is a CBU?

CBU (Clave Bancaria Uniforme) is Argentina's standardized banking code used to identify bank accounts. It's a 22-digit number with the following structure:

Position:  1-3    4-7     8       9-21           22
           ───    ────    ─       ─────────────  ─
           014    0000    0       0000000000001  2
           │      │       │       │              │
           │      │       │       │              └─ Second check digit
           │      │       │       └─ Account number (13 digits)
           │      │       └─ First check digit
           │      └─ Branch code (4 digits)
           └─ Bank code (3 digits)

Installation

npm install cbu
pnpm add cbu
bun add cbu

Usage

import { isValid, parse, safeParse, format, generate, getBankName } from "cbu";

// Validate a CBU
isValid("0720285088000001603240"); // true
isValid("0720285088000001603299"); // false (wrong check digit)

// Parse a CBU (throws on invalid)
const cbu = parse("0720285088000001603240");
cbu.bankCode;      // "072"
cbu.bankName;      // "Banco Santander Argentina"
cbu.branchCode;    // "0285"
cbu.accountNumber; // "8800000160324"

// Safe parse (returns null on invalid)
safeParse("invalid"); // null
safeParse("0720285088000001603240"); // { bankCode: "072", ... }

// Format a CBU
format("0720285088000001603240", " ");  // "07202850 88000001603240"
format("0720285088000001603240", "-");  // "07202850-88000001603240"

// Generate a CBU from components
generate("072", "0285", "8800000160324"); // "0720285088000001603240"

// Look up bank name
getBankName("072"); // "Banco Santander Argentina"
getBankName("011"); // "Banco de la Nación Argentina"
getBankName("999"); // null (unknown)

API

isValid(input: string): boolean

Validates whether a CBU is valid by checking length and both check digits.

isValid("0720285088000001603240"); // true
isValid("invalid");                // false
isValid("072028508800000160324");  // false (wrong length)

parse(input: string): CBU

Parses a CBU string and returns its components. Throws an Error if the CBU is invalid.

const cbu = parse("0720285088000001603240");
// {
//   raw: "0720285088000001603240",
//   bankCode: "072",
//   bankName: "Banco Santander Argentina",
//   branchCode: "0285",
//   accountNumber: "8800000160324"
// }

parse("invalid"); // throws Error

safeParse(input: string): CBU | null

Same as parse, but returns null instead of throwing on invalid input.

safeParse("0720285088000001603240"); // { bankCode: "072", ... }
safeParse("invalid");                // null

format(input: string, separator: string): string

Formats a CBU with the specified separator between the two blocks (8 + 14 digits).

format("0720285088000001603240", " ");  // "07202850 88000001603240"
format("0720285088000001603240", "-");  // "07202850-88000001603240"
format("0720285088000001603240", "");   // "0720285088000001603240"

generate(bankCode: string, branchCode: string, accountNumber: string): string

Generates a valid CBU from its components, computing both check digits automatically.

generate("072", "0285", "8800000160324"); // "0720285088000001603240"
generate("14", "1", "123");               // "0140001000000000001232" (padded)

getBankName(bankCode: string): string | null

Returns the bank name for a given 3-digit bank code, or null if unknown.

getBankName("072"); // "Banco Santander Argentina"
getBankName("011"); // "Banco de la Nación Argentina"
getBankName("143"); // "Brubank"
getBankName("999"); // null

Types

interface CBU {
  /** The raw 22-digit CBU string */
  raw: string;
  /** Bank code (digits 1-3) */
  bankCode: string;
  /** Bank name, or null if unknown */
  bankName: string | null;
  /** Branch code (digits 4-7) */
  branchCode: string;
  /** Account number (digits 9-21) */
  accountNumber: string;
}

Supported Banks

The library includes names for 50+ Argentine banks, including:

  • Banco de la Nación Argentina (011)
  • Banco de la Provincia de Buenos Aires (014)
  • Banco Santander Argentina (072)
  • Banco Macro (285)
  • Banco Galicia (007)
  • BBVA Argentina (017)
  • HSBC Argentina (150)
  • Brubank (143)
  • And many more...

Features

  • Zero dependencies
  • Full TypeScript support
  • Works in Node.js, browsers, and edge runtimes
  • ESM and CommonJS support
  • Tree-shakeable
  • Tiny bundle size (~1.2 KB gzipped)

License

MIT