uint256.xyz is a deterministic big integer calculator designed for blockchain developers. It supports uint256 arithmetic, commonly used in Ethereum smart contracts and Solana programs. The calculator supports e18, e9, and e12 precision, complex expressions with parentheses, exponentiation, sqrt operations, rounding operators, and powerful variables and formula management. Unlike traditional calculators, all calculations are integer-only and deterministic, ensuring accurate on-chain results.
This tool is ideal for Ethereum and Solana developers, DeFi engineers, token analysts, and anyone who works with large integer values or fixed-point arithmetic. Save your frequently used variables and expressions for quick reuse, and share calculations with your team via URL.
uint256 is a 256-bit unsigned integer type used in Ethereum smart contracts and other blockchain platforms. It can store extremely large integer values without losing precision.
e18 represents 1018 precision, commonly used in Ethereum tokens (ERC20) to handle decimals in integer form. This calculator also supports e9 and e12 precision for other tokens or Solana programs.
You can perform addition (+), subtraction (-), multiplication (*),
division (/), exponentiation (^), square root (sqrt()),
bitwise operations (&, |, ^, ~, <<, >>),
and use parentheses for complex expressions. Additionally, rounding
operators are available for decimal-to-integer conversion.
Variables allow you to store named values that can be reused
in calculations. For example, you can define x = 1000000000
(1e18) and then use x in any expression like x * 2 or
x + y. Variables are automatically substituted with their values
when you calculate.
Variable names must start with a letter and can contain letters and numbers.
They are case-sensitive, so Price and price are
different variables.
Saved expressions (also called formulas) let you store complex
calculations for reuse. For example, you can save a formula like
x * y / 1e18 for token amount calculations, or
sqrt(x * x + y * y) for distance calculations.
Click on a saved expression to load it into the calculator. Variables in the expression are automatically substituted with their current values.
Yes! Click the share icon on any history entry or saved expression to copy a shareable URL. When someone opens the link, the expression and variables are automatically loaded into their calculator. This is perfect for sharing calculations with teammates or documenting your work.
Rounding operators are special functions that evaluate expressions using decimal arithmetic internally, then convert the result to an integer using the specified rounding mode. This is essential for DeFi calculations where you need precise control over how fractional values are handled.
Unlike standard integer division (which always truncates), rounding operators let you choose exactly how to handle remainders - crucial for fee calculations, token distributions, and price computations in smart contracts.
The calculator supports 7 rounding modes, each with different behavior for handling decimal values. Choose the right mode based on your use case:
Rounds to the nearest integer. When the value is exactly halfway (0.5), it rounds up (away from zero). This is the most common rounding mode used in everyday calculations.
RHU(5/2) = 3 (2.5 → 3)RHU(7/2) = 4 (3.5 → 4)RHU(7/3) = 2 (2.33... → 2)Rounds to the nearest integer. When the value is exactly halfway (0.5), it rounds down (toward zero).
RHD(5/2) = 2 (2.5 → 2)RHD(7/2) = 3 (3.5 → 3)Rounds to the nearest integer. When the value is exactly halfway (0.5), it rounds to the nearest even number. This reduces cumulative rounding bias and is commonly used in financial calculations.
RHE(5/2) = 2 (2.5 → 2, nearest even)RHE(7/2) = 4 (3.5 → 4, nearest even)RHE(9/2) = 4 (4.5 → 4, nearest even)Always rounds toward zero. Positive numbers get smaller, negative numbers get closer to zero. This is equivalent to truncation.
RD(7/3) = 2 (2.33... → 2)RD(8/3) = 2 (2.66... → 2)RD(-7/3) = -2 (-2.33... → -2)Always rounds away from zero. Positive numbers get larger, negative numbers get more negative. Useful when you need to ensure a minimum value.
RU(7/3) = 3 (2.33... → 3)RU(1/1000) = 1 (tiny positive → 1)RU(-7/3) = -3 (-2.33... → -3)Always rounds toward negative infinity. Both positive and negative numbers round down on the number line. This is the standard mathematical floor function.
FL(7/3) = 2 (2.33... → 2)FL(-7/3) = -3 (-2.33... → -3)FL(5/2) = 2 (2.5 → 2)Always rounds toward positive infinity. Both positive and negative numbers round up on the number line. This is the standard mathematical ceiling function.
CL(7/3) = 3 (2.33... → 3)CL(-7/3) = -2 (-2.33... → -2)CL(5/2) = 3 (2.5 → 3)The calculator includes a powerful formula management system that lets you save and reuse variables and expressions. This is especially useful for DeFi calculations where you frequently work with the same values or formulas.
Variables store named values that can be used in any calculation. Create variables in the sidebar panel and click on them to insert into your expression.
x = 1000000000000000 - Store 1e18 as variable xprice = 0x2386f26fc10000 - Store hex value as pricedecimals = 18 - Store token decimals
Then use them in calculations: x * price / 10^decimals
Save complex expressions for quick reuse. Expressions can include variables, operators, and functions. When you click a saved expression, variables are automatically substituted.
amount * price / 1e18 - Token value calculationRD(total * fee / 10000) - Fee calculation with roundingsqrt(x * x + y * y) - Distance formula(x << 128) | y - Pack two 128-bit valuesShare any calculation or formula via URL. Click the share icon to copy a link that includes:
Recipients can open the link to see the exact same calculation with all values pre-filled. Perfect for team collaboration and documentation.
All variables, expressions, and calculation history are automatically saved to your browser's localStorage. Your data persists across sessions - no account required.
Wrap any expression in a rounding function to evaluate with decimal precision:
RD(100/3) = 33 - Integer division with round downRU(100/3) = 34 - Integer division with round upRHU(100/3) = 33 - Nearest integer (33.33... rounds to 33)Rounding operators can be nested for complex calculations:
RU(RD(10/3) + 1/2) = 4 - RD(10/3)=3, then 3+0.5=3.5, RU(3.5)=4RD(RU(7/3) * 2/3) = 2 - RU(7/3)=3, then 3*2/3=2, RD(2)=2Common scenarios in smart contract development:
RD(amount * feeRate / 10000) - Round down fees to favor usersRU(totalTokens / recipients) - Round up to ensure full distributionRHE(price * quantity / 1e18) - Banker's rounding for fair pricing
Standard integer division (/) always truncates toward zero, equivalent to RD.
Use rounding operators when you need different behavior:
7/3 = 2 (standard integer division)RD(7/3) = 2 (same as integer division)RU(7/3) = 3 (rounds up instead)RHU(7/3) = 2 (nearest integer)Yes. This calculator uses integer-only arithmetic and avoids floating point operations, making it deterministic and suitable for blockchain calculations. The rounding operators use high-precision decimal arithmetic internally but always produce integer results.
This tool is designed for Ethereum and Solana developers but can be used for any platform that requires precise big integer calculations, including Bitcoin, Cosmos, Polkadot, and other blockchains.
Use regular division (/) when truncation toward zero is acceptable.
Use rounding operators when you need specific rounding behavior: