Number Base Converter
Type a number, choose the base it is in and the base you want. You get the answer, the steps, and the same number in binary, octal, decimal and hex.
https://flxcode.com/number-base-converter/
Example
255 in base 10 (decimal) is FF in base 16 (hexadecimal).
Steps
- Divide by 16 again and again. The remainders, read from the last to the first, are the digits: 255 ÷ 16 = 15 remainder 15 (F); 15 ÷ 16 = 0 remainder 15 (F).
The same number in the common bases
| Base | Value |
|---|---|
| base 2 (binary) | 1111 1111 |
| base 8 (octal) | 377 |
| base 10 (decimal) | 255 |
| base 16 (hexadecimal) | FF |
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Worked examples
| Input (base) | Result (base) | Note |
|---|---|---|
| 18446744073709551616 (10) | 10000000000000000 (16) | 2⁶⁴, the first number a 64-bit register cannot hold |
| 255 (10) | 1111 1111 (2) | The largest value of one byte |
| 777 (8) | 511 (10) | Unix permissions rwxrwxrwx |
| zz (36) | 1295 (10) | Base 36 uses 0 to 9 and a to z |
| -FF (16) | -255 (10) | A minus sign is kept in front |
| 0.1 (10) | 0.0(0011) (2) | Repeats forever in binary, so it is cut and marked |
| 0.625 (10) | 0.101 (2) | Ends: 0.625 = 5/8 |
| 101.101 (2) | 5.625 (10) | A binary point: the places after it are halves, quarters, eighths |
0 to 15 in four bases
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
How a conversion works
Every number is a sum of digits times powers of the base. To read a number in any base, add those up, and you have it in decimal. To write a decimal number in another base, divide it by the base again and again and keep the remainders: the last remainder is the first digit. For the part after the point, multiply by the base and take the whole part each time.
Pages for the three most searched cases have their own tool and examples: hex to decimal, binary to decimal and decimal to binary. To see what text looks like in bytes, use the text to binary converter.
Numbers this uses
- Bases 2 to 36. Digits 0 to 9, then A to Z (case does not matter on input, output is upper case).
- Input up to 1,000 characters, converted exactly with BigInt.
- Fractions: the digit loop stops when the remainder repeats or ends, or after 64 digits, and the result says which.
- Two's complement is listed for negative whole numbers that fit in 8, 16, 32 or 64 bits.
Nothing you type is uploaded. We count events without cookies (details).
FAQ
What is a number base?
The count of digits a number system uses. Base 10 has ten digits, 0 to 9, and each place is worth ten times the one to its right. Base 2 has two digits and each place is worth twice the one on its right. Base 16 has sixteen digits: 0 to 9 and A to F.
Which bases does it handle?
Any base from 2 to 36. Bases above 10 use letters: A is 10, B is 11, up to Z, which is 35. Upper or lower case both work as input. Binary, octal, decimal and hexadecimal are at the top of the menus because they are the ones people use most.
How big a number can I convert?
Up to 1,000 characters. The tool uses BigInt, so there is no 2⁵³ limit like a calculator that uses floats. 2⁶⁴ = 18446744073709551616 converts to 10000000000000000 in hex without a rounding error.
How are negative numbers handled?
With a minus sign in front: −FF in hex is −255 in decimal. That is sign and size, which is how people write numbers. Computers store negatives in two's complement instead, so for a negative whole number the tool lists the 8, 16, 32 and 64-bit patterns that fit.
What about fractions, like 0.1?
A point is allowed. Some fractions end in one base and repeat in another. 0.1 in decimal is 0.0(0011) in binary, where the part in brackets repeats forever. That is why 0.1 + 0.2 is not exactly 0.3 in floating point. The tool cuts anything that has not ended after 64 digits and tells you.
Why does binary come out in groups of 4?
Four bits make one hex digit, so 1111 1111 is easy to read as FF. The grouping only adds spaces and leading zeros so the groups are full (5 shows as 0101). The copy button gives the plain digits with no spaces.
Can I type 0x, 0b or 0o in front?
Yes, when it matches the base you are converting from: 0xFF with From base 16, 0b1010 with base 2 and 0o17 with base 8. Spaces and underscores inside the number (1111_0000) are ignored.
Are my numbers saved or sent anywhere?
No. The conversion runs in your browser. What you type is not put in the address bar, not stored and not counted. We only count the base you converted to (2, 8, 10, 16 or other).
More from FLXCode
Hex to Decimal ConverterNew
Turn hexadecimal into decimal, with the place values worked out. Also binary, octal and bases up to 36.
Binary to Decimal ConverterNew
Turn binary into decimal with the place values shown. Handles spaces, long numbers and a binary point.
Decimal to Binary ConverterNew
Turn decimal into binary with the divide-by-2 steps, bits grouped by 4, and negative numbers in two's complement.
Long Division CalculatorNew
Long division laid out like on paper, with the remainder and the decimal, repeating part marked.