Number Base Converter: Decimal, Binary, Octal, Hex
Type a non-negative whole number, choose its base, and read the same value in decimal, binary, octal and hexadecimal. Type the digits only (0 to 9), up to 16 digits. A digit that does not exist in the chosen base, such as 2 in binary or 8 in octal, gives an out-of-range error.
Updated
Report a problem
Formula
Reading a number in base b: value = sum of digit × b^position. Converting out: divide repeatedly by the target base and read the remainders from last to first.
Worked example
Decimal 255: 255 = 15 × 16 + 15, so hexadecimal is FF; in binary it is 11111111 (eight 1s) and in octal 377 (3 × 64 + 7 × 8 + 7).
Frequently asked questions
How do I convert decimal to binary?
Divide the number by 2 repeatedly and read the remainders from last to first. For 13: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1, so 13 is 1101.
How do I convert binary to decimal?
Add the powers of 2 where there is a 1. For 1010 that is 8 + 2 = 10.
Why can I not type letters for hexadecimal?
The input accepts numbers only, so a hexadecimal value can only use the digits 0 to 9 here. Use decimal as the starting base to see letters in the result: 255 is FF.
What is the largest number I can convert?
The number you type is read as a string of digits, with at most 16 digits and a numeric value no larger than 9007199254740991. That means binary input is limited to 16 digits (1111111111111111 = 65535), and octal, decimal and hexadecimal (digits 0 to 9 only) input to 16 digits each, still capped at 9007199254740991. The decimal result is exact up to 9007199254740991 at most, which is 53 binary digits. Digits that do not exist in the chosen base, such as 2 in binary or 12 in base 2, are rejected with an out-of-range error.