Binary Calculator
Repeated division by 2: remainder at each step gives binary digits (least significant first).Free online tool
Enter a whole number from 0 to 9,007,199,254,740,991 to find its binary and hexadecimal representations.
Instant calculation
Enter a whole number from 0 to 9,007,199,254,740,991 to find its binary and hexadecimal representations.
Calculation inputs are processed in your browser. Copying or sharing a result is your choice. See our privacy policy for advertising and technical logs.
Tool and explanation maintained by Leslie. Report an incorrect result.
Input steps
Enter a non-negative whole number in base ten.
Select Calculate to see the binary digits and hexadecimal equivalent.
Binary digits read right to left: least significant bit to most significant.
The formula
Divide the number by 2 repeatedly, recording remainders. The binary representation is the remainders read in reverse.
Repeated division by 2: remainder at each step gives binary digits (least significant first).Check the method
Each example follows the same formula used by the calculator.
42÷2=21 r0; 21÷2=10 r1; 10÷2=5 r0; 5÷2=2 r1; 2÷2=1 r0; 1÷2=0 r1 → 101010101010Decimal 42 is binary 101010 because 32 + 8 + 2 = 42. A leading zero does not change an unsigned number's value, but fixed-width computer formats may require padding.
Decimal 13 converts to binary 1101 because 8 + 4 + 1 = 13. Decimal 16 is 10000; crossing a power of two adds another binary digit. The rightmost positions represent 1, 2, 4, 8 and so on.
Binary 1101 and 00001101 have the same unsigned value, but an eight-bit protocol may require the padded form. This tool does not select a storage width, represent signed two's-complement values or convert fractional binary numbers. JavaScript number precision also limits large integers; use values within the safe integer range and a dedicated arbitrary-precision tool for larger inputs.
Method notes updated by Leslie.
Common questions
This page converts a non-negative integer to an ordinary binary representation. It does not choose a bit width or implement a signed two's-complement or floating-point encoding.
Continue calculating