# indutny/bn.js

BigNum in pure javascript

Repository: https://github.com/indutny/bn.js
Canonical: https://ross.abutalabs.com/products/bnjs
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2026-07-09T04:24:18+00:00

## Health v2 (maintenance only)
Score: 64/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 91, release rhythm 8, longevity 100
- inputs: {"age_days": 4512, "days_push": 55, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1230, forks 154 (observed 2026-08-28T04:04:03.728284+00:00)

## What it is
bn.js is a pure JavaScript arbitrary-precision integer (BigNum) arithmetic library supporting addition, multiplication, modular reduction, Montgomery reduction, and bit operations. It runs in both Node.js and browsers with no native dependencies.

## Use cases
- do big integer arithmetic in javascript
- implement cryptography like RSA or ECC in JS
- handle numbers larger than Number.MAX_SAFE_INTEGER
- perform modular arithmetic and Montgomery multiplication
- convert big integers between bases and byte arrays

## When to choose
- you need arbitrary-precision integers in Node.js or the browser without native modules
- you need a battle-tested bignum library used by crypto libraries like elliptic
- you need integer-only math (no decimals) with in-place operation optimizations

## When to avoid
- you need decimal or floating-point arithmetic
- you need BigInt-level performance and can use native JS BigInt instead
- you need arbitrary-precision decimals like for financial calculations

## Facets
- artifact type: library
- maturity: stable
- function: math, serialization
- domain: developer-tools
- platform: browser, cross-platform
- tags: bignum, arbitrary-precision-arithmetic, biginteger, montgomery-reduction, pure-javascript, algorithms, cryptography, nodejs, javascript

## Member repositories
- indutny/bn.js (main) score 64

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:03.728284+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:15:02.252615+00:00, confidence not recorded.
  - readme: https://github.com/indutny/bn.js (fetched 2026-08-28T04:04:03.728284+00:00, sha ebd8d4a64c17)
  - registry_npm: https://registry.npmjs.org/bn.js (fetched 2026-08-29T12:22:19.380148+00:00, sha ed45fd617411)
- Data as of 2026-08-30T08:39:29.467469+00:00.
