Binary and Hex Calculator

Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, exactly, with every step shown.

Decimal integer255

A whole number, such as FF or 1010. A minus sign is allowed; fractions and two’s-complement bit patterns are not.

The number system your number is written in.

Decimal integer

255

  • Base 3673
  • Binary11111111
  • Octal377
  • HexadecimalFF

Negative results use a minus sign, not a fixed-width bit pattern. Arbitrary-precision conversion is limited to 1,024 input digits for responsiveness.

How this was calculated

  1. Each place in a base-16 number is worth 16 times the place to its right. Multiply every digit by its place value, then add them up. Letters stand for digits above 9: A = 10, B = 11, and so on.Value = sum of (digit × base^place)Put in your numbers: FF₁₆ = 15 × 16¹ + 15 × 16⁰ = 15 × 16 + 15 × 1 = 240 + 15Answer: 255 in decimal
  2. To write the number in base 36, keep dividing by 36 and write down each remainder (what is left over). Read the remainders from the last one back to the first.Divide by 36 until you reach 0Put in your numbers: 255 ÷ 36 = 7 remainder 3; 7 ÷ 36 = 0 remainder 7Answer: 73 in base 36
  3. Binary, octal and hexadecimal are found the same way, dividing by 2, 8 and 16: 11111111 (binary), 377 (octal), FF (hex). Whole numbers are worked out exactly, so no digits are lost to rounding.

Number bases in simple words

We normally count in base 10. That means we use ten digits, 0 to 9, and each place is worth 10 times the place to its right: ones, tens, hundreds.

Other bases work the same way with a different number. Binary (base 2) uses only 0 and 1, and each place is worth 2 times the one before: 1, 2, 4, 8, 16. Hexadecimal (base 16) needs sixteen digits, so after 9 it uses letters: A = 10, B = 11, up to F = 15.

To read a number in any base, multiply each digit by what its place is worth and add. For example, hex 2A means 2 sixteens and 10 ones: 2 × 16 + 10 = 42. In binary, 101010 is 32 + 8 + 2 = 42 too.

To go the other way, keep dividing by the new base and write down the remainders. 42 ÷ 2 = 21 r 0, 21 ÷ 2 = 10 r 1, 10 ÷ 2 = 5 r 0, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading the remainders from bottom to top gives 101010.

Formula and method

Each digit contributes its value multiplied by a power of the input base. Repeated division expresses the same integer in another base.

Worked example

Hexadecimal FF represents 15 × 16 + 15 = 255, equivalent to binary 11111111 and octal 377.

Frequently asked questions

Does it interpret negative values as two’s complement?

No. Negative values retain a minus sign. Fixed-width machine encodings require a bit width and use different rules.

Last updated . Results are estimates for informational purposes only.