Skip to content

For developers

break_infinity.js and 11 Other Big Number Libraries for Idle Games, With What Each Can Actually Hold

break_infinity.js, break_eternity.js, decimal.js, BigInt and Unity and Godot ports: 12 big number options for idle games, with ranges, licences and trade-offs.

break_infinity.js is the default big number library for JavaScript incremental games: it replaces the JavaScript number, which turns into Infinity at about 1.8e308, with a Decimal class that goes to 1e9e15 and is fast enough to run every tick. If your numbers climb further, to towers of exponents, use its sequel break_eternity.js. If your numbers never pass 1e308, you may not need a library at all, and plain numbers will be faster and simpler.

Below are the 12 options worth knowing, from the two Patashu libraries to accuracy-first decimal libraries, native BigInt, ports for Unity and Godot, and the formatting packages that turn these numbers into something readable. Ranges, licences and versions come from each project's own README and the npm registry, checked in November 2026.

01

break_infinity.js: best for most JavaScript incrementals that pass 1e308

Platform: JavaScript and TypeScript · npm v2.2.0 · MIT licence

Patashu's break_infinity.js stores a number as a mantissa and an exponent, so it can represent values "bigger in magnitude than 1e308, up to as much as 1e9e15", in the README's words, while prioritising speed over accuracy. It exports one Decimal class with a decimal.js-compatible API: new Decimal('1e500'), then chained calls like x.times(y).plus(z).floor(). Install it with npm install break_infinity.js, or load it from jsDelivr with a script tag.

Its best-known user is Antimatter Dimensions, whose current source still lists break_infinity.js as a dependency; the README reports AD's script time improved 4.5x after swapping from decimal.js. The README's own benchmarks show it 2.5x to 442x faster than decimal.js depending on the operation, with the biggest gains on pow, exp and log10, which are exactly what idle formulas use.

Watch out for: JavaScript operators do not work on Decimals: a + b will not add two Decimals correctly, so every formula must use .add, .mul and friends. Comparisons need .gte and .lt, not >= and <.

02

break_eternity.js: best for games that reach towers of exponents like ee1e10

Platform: JavaScript and TypeScript · npm v2.1.3 · MIT licence

break_eternity.js is the sequel. It represents numbers as a sign, a layer and a magnitude, where each layer is another 10 to the power, so it can reach 10^^1e308 (ten tetrated) and very small numbers like 1e-400 that break_infinity cannot. The README says it is within roughly 2x of break_infinity's speed and has the same interface, and it adds hyperoperators such as tetrate, slog and pentate.

The Modding Tree ships break_eternity.js in its technical folder, so every game built on it, from The Prestige Tree onwards, already uses it. Pick it if your design has inflation layered on inflation, or if you simply do not want to discover your ceiling in the endgame.

Watch out for: Moving from break_infinity is not quite drop-in: in break_eternity, log, log10 and ln return a Decimal rather than a Number, so any code that does arithmetic on exponents needs updating.

03

Plain numbers (64-bit floats): best for games whose economy tops out below 1e300

Platform: Any language · built in · free

A JavaScript number, a C# double and a GDScript float are all 64-bit floating point, with a maximum of about 1.8e308 and about 15 to 17 significant digits. That is enough for a great many idle games, especially ones with a story or an ending, and native math is far faster and easier to read than method chains.

Our own game is an example: Mushies!, the site maintainer's Godot clicker, stores its currencies as plain GDScript floats because its economy is designed to stay well inside that range. Decide early by projecting your late-game production: if the exponent might keep climbing with every prestige, plan for a library now.

Watch out for: Above about 9e15 (2^53) a float can no longer represent every integer, so adding 1 to a huge number does nothing. Players notice this as costs or counts that stop changing.

04

decimal.js: best for exact results where accuracy matters more than speed

Platform: JavaScript · npm v10.6.0 · MIT licence

MikeMcl's decimal.js is an arbitrary-precision Decimal type: you set the number of significant digits and every calculation is rounded to that precision. It is one of the most used libraries on npm, with about 394 million downloads in October 2026, and break_infinity's README says plainly that if you want to prioritise accuracy over speed, use decimal.js instead.

In an idle game that is rarely the right trade, but it suits simulations where exact decimal results matter, such as a stock-market or economics incremental, or tools that check your balance formulas offline. The same author's bignumber.js and the 6 KB big.js cover similar ground with smaller APIs.

Watch out for: Arbitrary precision costs time. In break_infinity's benchmarks decimal.js is 121x slower at log10 and over 400x slower at exp and pow, which matters when you call them thousands of times a second.

05

Native BigInt: best for exact integer counters with no dependency

Platform: JavaScript built in · all modern browsers

BigInt (written as 123n) stores whole numbers of any size exactly. It is built into the language, so there is nothing to install, and it is ideal for things that are always integers and must never lose a digit: total clicks, item counts, or a seed.

For most idle economies it is the wrong tool. MDN notes that BigInt cannot be used with Math methods, cannot be mixed with Number in arithmetic, and that division truncates toward zero because BigInt cannot represent fractions. Production rates, multipliers and square-root prestige formulas all need fractions.

Watch out for: JSON.stringify throws a TypeError on any BigInt value, so your save function breaks the day you add one. Store BigInts as strings in the save and convert them back on load.

06

Store the logarithm yourself: best for pure multiplication economies that must be very fast

Platform: Any language · a technique, no library

If every value in your game is positive and you mostly multiply, you can store log10 of each value in an ordinary float. Multiplication becomes addition, powers become multiplication, and the range goes up to 10^1.8e308. Adding two numbers needs a small helper (log10(10^a + 10^b), computed safely as the larger plus log10(1 + 10^(smaller minus larger))).

break_infinity's README lists an example of this approach, logarithmica_numerus_lite.js by aarextiaokhiao, and describes it as roughly 2x faster than break_infinity but unable to represent negative numbers. It is a good fit for a prototype or a very hot inner loop.

Watch out for: Subtraction and zero are awkward in log space, and so is spending currency down to exactly nothing. Most developers who start here move to break_infinity once the game has a shop.

07

ExpantaNum.js and OmegaNum.js: best for googology games built around absurd notations

Platform: JavaScript · MIT licence · by Naruyoko

Naruyoko's two libraries go far past break_eternity. ExpantaNum.js describes itself as handling arithmetic for numbers as large as {10,9e15,1,2} in Bowers' array notation, and OmegaNum.js holds up to 10{1000}9e15 in up-arrow terms. Both were still being updated in October 2026.

Pick one only if the size of the numbers is the joke and the point, as in incrementals whose late game is about naming ever-larger notations. break_infinity's README files them under libraries that "have low performance but can represent insanely large googological numbers".

Watch out for: Speed is the trade. Keep the number of Decimal operations per tick small, cache derived values, and benchmark on a slow laptop before you commit.

08

BreakInfinity.cs: best for Unity idle games that outgrow double

Platform: C# and Unity · single file · MIT licence

Razenpok's BreakInfinity.cs is the C# port of break_infinity.js, with the same 1e(9e15) range. Installation is one file: drop BigDouble.cs into your Scripts folder and use BigDouble instead of double. It supports the usual ToString formats (G, E, F) so it slots into existing UI code.

Because C# has operator overloading, formulas stay readable, which is a real advantage over the JavaScript libraries. It is the obvious choice for Unity, which is the engine behind many commercial idlers such as NGU Idle and Cell to Singularity, according to PCGamingWiki.

Watch out for: The repository's last push was in December 2022. It is small and stable, but expect to fix any edge cases yourself rather than wait for upstream.

09

GodotBigNumberClass (Big.gd): best for Godot idle games with hundreds of digits

Platform: Godot 4.1 and later, and 3.x · GDScript · MIT licence

ChronoDK's Big.gd is a GDScript class for very large numbers, made with idle games in mind. For Godot 4.1 and later you drop the file into your project, then create values with Big.new(100) or Big.new(2, 6) for a mantissa and exponent (two million). It also formats numbers into AA-notation such as 2.00M, 4.56AA or 7.89ZZ.

It is the most established Godot option, with about 200 GitHub stars and a push in May 2026. If you are deciding between Godot and other engines for an idle project, our engine guide covers the rest of the stack.

Watch out for: GDScript has no operator overloading, and the README warns that some operations modify the instance they are called on. Copy values with Big.new(other) before doing math you do not want to stick.

10

Ports for Rust, Python, Java and C++: best for native or server-side code that must match a JS game

Platform: Community ports listed in the break_infinity.js README

The break_infinity README links community ports: break-infinity.rs (Rust, MPL-2.0, numbers up to 1e1.79e308), expol.py (Python, GPL-3.0), BreakInfinity.java, and BigNumPlusPlus for C++. These are useful when a server must check leaderboard scores or validate saves with the same math as the browser client.

Treat them as starting points. Most are maintained by one person, and several were last updated in 2024.

Watch out for: Check each port's licence before shipping. expol.py is GPL-3.0, which has obligations a closed-source commercial game may not want, and its own description calls it buggy.

11

@antimatter-dimensions/notations: best for giving players a choice of notations in one import

Platform: JavaScript · npm v3.2.0 · MIT licence · needs break_infinity.js

The Antimatter Dimensions team publishes every notation from the game as a package: scientific, engineering, letters, and the stranger ones players love to switch to. It works on break_infinity.js Decimals, loads from a CDN after break_infinity, and has a live demo page.

Notation choice is a genre expectation once numbers pass a few dozen digits, and writing a dozen formatters is tedious. This is a fast way to ship an options menu that feels like the games your players already know.

Watch out for: It is built around break_infinity's Decimal. If you use break_eternity or plain numbers, convert before formatting or write your own formatter.

12

swarm-numberformat: best for readable words like 10.000 billion with plain numbers

Platform: JavaScript · npm v0.4.0 · MIT licence

erosson wrote swarm-numberformat for Swarm Simulator. It formats ordinary numbers as standard names (10.000 billion), scientific (1.0000e10), engineering (10.000E9) or long scale (10.000 milliard), and the README suggests letting players pick their favourite in an options menu.

It is a good partner for the plain-numbers approach: if your game stays under 1e308, this gives you named numbers and notation choice without adopting a big number class.

Watch out for: Its standard and long-scale formats fall back to scientific notation at 1e249, so very late game values will switch style on their own.

How to choose a big number library

Answer three questions about your game and the choice is usually obvious.

01

Match it to your ceiling

Project the largest value a dedicated player could reach. Under 1e300: plain numbers plus a formatter such as swarm-numberformat. Up to 1e9e15: break_infinity.js (or BreakInfinity.cs in Unity, Big.gd in Godot). Beyond that, or towers of exponents: break_eternity.js. Only reach for ExpantaNum.js or OmegaNum.js if huge notation is the theme.

02

Match it to your language

In JavaScript every library forces method calls instead of operators, so write formulas in small named functions. In C#, BreakInfinity.cs keeps normal operators. In GDScript, Big.gd needs method calls and care with in-place changes. If a server must verify scores, pick a library with a port in the server's language.

03

Match it to your saves

Decide how numbers serialise before players have saves. break_infinity and break_eternity Decimals round-trip through strings; BigInt needs manual string conversion. Switching libraries after launch means migrating every save, so test a save from the oldest version you support. Our save system guide covers versioning.

Swap your first formula today

Pick the library that matches your ceiling, wrap it in a tiny module of your own (add, mul, format, toSave, fromSave) and convert one generator to use it. If the game still runs at full speed with a hundred generators ticking, convert the rest. If you are still deciding on the rest of the stack, start with our JavaScript tutorial.

When your game is ready for players, list it on IncrementalGames.org for free. The optional Get featured placement adds a labelled Featured card on the home page, game pages and best-of lists from $30 a week.

List your game free →

Common questions

What is break_infinity.js?

A JavaScript library by Patashu that replaces the built-in number for incremental games. It handles values up to about 1e9e15, far past JavaScript's 1.8e308 limit, and prioritises speed over accuracy. It is MIT-licensed and Antimatter Dimensions uses it.

What is the difference between break_infinity.js and break_eternity.js?

break_eternity.js is the sequel. It adds layers of exponents, so it reaches 10^^1e308 and very small numbers, and supports tetration. It is within about 2x of break_infinity's speed, but log functions return Decimals instead of Numbers.

What is the largest number in JavaScript?

Number.MAX_VALUE is about 1.8e308. Beyond that a number becomes Infinity. Integers are only exact up to 2^53, about 9e15, which is why idle games use libraries such as break_infinity.js for larger values.

Can I use BigInt for an idle game?

Only for whole-number counters. BigInt has no fractions, cannot mix with Number in arithmetic, cannot use Math methods, and JSON.stringify throws on it. Production rates and multipliers need a Decimal library or plain floats.

How do Unity and Godot idle games handle big numbers?

Unity games commonly use BreakInfinity.cs, a C# port of break_infinity.js that you add as a single BigDouble.cs file. Godot games can use ChronoDK's Big.gd class, or plain floats if the economy stays under about 1e308.

Sources