Free online tool

Binary Calculator

Enter a whole number from 0 to 9,007,199,254,740,991 to find its binary and hexadecimal representations.

Instant calculation

Binary Calculator

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

How to use this calculator

  1. 01

    Enter decimal number

    Enter a non-negative whole number in base ten.

  2. 02

    Calculate

    Select Calculate to see the binary digits and hexadecimal equivalent.

  3. 03

    Read binary

    Binary digits read right to left: least significant bit to most significant.

The formula

How this calculation works

Divide the number by 2 repeatedly, recording remainders. The binary representation is the remainders read in reverse.

Binary Calculator

Repeated division by 2: remainder at each step gives binary digits (least significant first).

Check the method

Worked examples

Each example follows the same formula used by the calculator.

What is 42 in binary?

42÷2=21 r0; 21÷2=10 r1; 10÷2=5 r0; 5÷2=2 r1; 2÷2=1 r0; 1÷2=0 r1 → 101010101010

Preserve place value

Decimal 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.

Check powers of two from right to left

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.

Decide whether the output is a number or a data format

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

Questions about this calculation

Does this encode signed integers or fractions?

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.