# What is uint256?

With regard to Solidity, What is UINT256?

From the token example at https://ethereum.org/token :

``````/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
``````

Beyond being a variable type in general computing, I'd love to gain a better of understanding and context in the Ethereum world. Why not just use an INT? Assuming it's a specific type of Integer, what does the "U" denote?

• It is an integer type solidity.readthedocs.io/en/develop/types.html#integers
– Ismael
Nov 5 '17 at 16:21
• I found, uint means unsigned int. uint doesn't allow for negative numbers, it has a range of 0 to 4,294,967,295, compared to the range of -2,147,483,648 to 2,147,483,647 for an int (Source: stackoverflow.com/questions/3068474/…) Nov 5 '17 at 16:30
• @BruceSeymour Those are default C# types - I'm pretty sure C# has a default int length that's way shorter than Solidity's default, thus different ranges. Nov 4 '19 at 18:19

With regard to Solidity...

This is really more a general computer science question that would best be answered on Stack Overflow.

At the risk of repeating what @Ismael has linked to...

• `U` - unsigned (meaning this type can only represent positive integers, not positive and negative integers)
• `INT` - integer
• `256` - 256 bits in size

Context: The EVM (Ethereum Virtual Machine) uses 256 bits as its word size. See: Rationale behind 256-bit words in EVM

Integers in Solidity:

`uint256` (`uint` is an alias) is a unsigned integer which has:

• minimum value of 0
• maximum value of 2^256-1 = 115792089237316195423570985008687907853269984665640564039457584007913129639935 //78 decimal digits

`int256` (`int` is an alias) is a signed integer which has:

• minimum value of -2^255 = -57896044618658097711785492504343953926634992332820282019728792003956564819968
• maximum value of 2^255-1 = 57896044618658097711785492504343953926634992332820282019728792003956564819967

For example, in Solidity we could write the following code:

``````uint8 public constant decimals = 6;
uint256 public constant totalSupply = 1000000*10**uint256(decimals); // 1000000000000
``````

P.S. It is unusual that `int`/`uint` in Solidity have 256 bits in size, because there are such popular languages as C#/Java that have `int` data type with 32 bits in size:

• minimum value of -2^31 = -2147483648
• maximum value of 2^31-1 = 2147483647
• I think 256 bits was chosen so that there would be enough addresses for the ethereum network to continue to work indefinitely. Jul 2 '19 at 8:14