If I have an ERC20 with 18 decimals and no limit defined in the contract, what is the system constraint of the max total supply?

Searched quite long and was surprised to not find anything about it.

1 Answer 1


If we look at the ERC20 implementation, the supply is defined as an uint256.

uint256 private _totalSupply;

In theory the maximum supply a token could reach is 2^256-1. Going over this would cause an overflow which is prevented by solidity 0.8 (will revert by default if not treated as unchecked). The decimals matter only when interpreting what this number is.

Just for the memes, we know that 2^256 will have log(2^256) + 1 digits so 78. Meaning that if you would have a 0 decimals, your biggest number would be

115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,936  - 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.