Max uint256 Token Approvals and What They Allow
What does max uint256 mean in a token approval? It is the largest ERC-20 allowance, letting a spender move any amount of that token you hold, now or later.
Onchain Report Newsroom#9bcf373 min read
A max uint256 token approval is the largest allowance an ERC-20 token can hold, allowing the approved spender to move any amount of that token in your wallet, now or later.
- Maximum: 2256 − 1, about 1.16 × 1077 raw units.
- Meaning: The spender can use the allowance for your whole balance of that token.
- Risk: A compromised or malicious spender could take that balance.
Max uint256 lets a spender use your full token balance
uint256 is an unsigned number type that can hold values up to 2256 − 1. That maximum is a 78-digit number, written in hexadecimal as 0x followed by 64 f’s. It is the same raw value regardless of a token’s decimals.
Take an illustrative swap: you approve a router to spend USDC with a max uint256 allowance. The router can move all the USDC you hold, and any USDC you receive later, until the allowance changes. It is not limited to the amount needed for the first trade.
Dapps often request this amount to avoid asking for another approval transaction on each later trade. That can save a separate transaction and its gas fee. But the approval gives the spender ongoing access to that token, so a contract exploit or malicious contract can put your whole balance at risk.
Not every huge allowance equals uint256 max. Permit2 stores amounts as uint160, and treats type(uint160).max as an allowance that does not decrease when used. That value is below uint256 max, but is still effectively unlimited: it can cover far more tokens than you could hold. revokecash tracks token approvals so wallet users can inspect allowances and manage them.
Some tools label the exact maximum “Unlimited”; others display a long number. In revokecash, the allowance column shows “Unlimited” for the max value, with options to revoke it or edit it down. Etherscan Token Approval Checker and MetaMask can also help you review approvals. A long number may be an unlimited allowance even when it is not the uint256 maximum, as with Permit2.
Related
Why do dapps ask for an unlimited approval?
Dapps use unlimited approvals to avoid asking you to approve each later trade in a separate transaction, which also avoids that transaction’s gas fee.
How does an unlimited approval appear in revokecash?
The allowance column shows “Unlimited” for the max value. You can revoke it or edit it down.
Questions about changing token approvals
Do token approvals with the max value ever expire?
A max allowance does not expire just because time passes. It stays in place until it is changed or revoked, unless the token or contract has its own rules.
Is it safe to keep an unlimited approval for a well-known DEX?
A well-known name does not remove the allowance’s risk. The spender can still use the approved token balance, so keep the approval only if you are comfortable with that access.
Does editing an unlimited approval to a lower amount cost gas?
Changing an on-chain allowance requires a transaction, which usually costs gas. The exact cost depends on the network and current conditions.