The same 42, three representations
Decimal 42 is written as 101010 in binary and 2A in hexadecimal. Binary weights 32, 8 and 2 are on. Adding them gives 42.
To convert binary to hexadecimal, group bits into blocks of four from the right. Leading zeros preserve the value: 0010 1010 becomes 2 A. Hexadecimal A means ten, so 2A = 2 × 16 + 10 = 42.
Each position has a weight
Binary: weights 1, 2, 4, 8, 16, 32…
Hexadecimal: weights 1, 16, 256, 4096…
Positions start at zero on the right. The tool shows each nonzero digit’s contribution and a table of successive divisions: divide the decimal value by the target base, keep the remainder and repeat with the quotient. Read the remainders in reverse order.
Bit buttons show their position and weight; their accessible names include the full decimal weight. Changing the input base preserves the number, and toggling bits updates every representation.
64-bit unsigned integers, without rounding
The range is 0 to 18,446,744,073,709,551,615 inclusive: 2⁶⁴ − 1. BigInt provides exact integer arithmetic, avoiding the precision loss of ordinary JavaScript numbers beyond 2⁵³ − 1.
Negative numbers, fractions, scientific notation, separators and prefixes such as 0x or 0b are not accepted. Visible width does not alter or truncate the number; it expands to the next available size if needed. This is not two’s complement or floating-point representation.
Common mistakes
- Assuming 10 means the same number in every base: it means two in binary and sixteen in hexadecimal.
- Counting the first bit as position 1: the rightmost bit is 2⁰.
- Interpreting F as fifteen positions: it is one digit with the value 15.
- Converting 64-bit integers with a numeric type that rounds large values.
Try it yourself
What is 1111 0000 in decimal and hexadecimal?
128 + 64 + 32 + 16 = 240. Groups 1111 and 0000 are F and 0: F0.
What happens if only bit 63 is on?
The value is 9,223,372,036,854,775,808. It is positive in this unsigned converter and is not interpreted as a negative number.