Number Base Converter
Convert between binary, octal, decimal and hexadecimal, up to base 36, with exact results even for very large numbers.
Number to convert
Result
Binary
1111 1111
Octal
377
Decimal
255
Hex
FF
73
8 bits in binary (1 bytes)
Convert between binary, octal, decimal and hexadecimal, up to base 36, with exact results even for very large numbers.
Binary
1111 1111
Octal
377
Decimal
255
Hex
FF
73
8 bits in binary (1 bytes)
Converts numbers between different bases such as binary, octal, decimal and hexadecimal. Use it for programming, computer studies, and when reading color codes or memory addresses. It works from base 2 up to base 36 and calculates very large numbers and negative numbers exactly.
Enter the number to convert and choose its base.
Check the results in base 2, 8, 10 and 16 and your chosen base at once.
Use the copy button to take the result you need.
It is 11111111 in binary and FF in hexadecimal. When all 8 binary digits are 1, the value is 255.
Yes. It calculates with JavaScript's BigInt, so it converts exactly with no limit on digits. Numbers with a decimal point aren't supported; only integers are converted.
It is the way computers represent negative numbers in binary. If you enter a negative number, it also shows the two's complement with the number of bits needed.
They are different ways of writing the same number in different bases. Decimal 255 is binary 11111111, octal 377 and hexadecimal FF. One hexadecimal digit matches exactly 4 binary digits, so converting is easy, as in FF = 1111 1111.
That is why computers often write memory values, color codes (#FF5733) and hash values in hexadecimal. This tool supports bases 2 to 36, and in base 36 it uses 0-9 and a-z, so 1000 becomes rs.
Linux's chmod 755 is octal. Each digit is the sum of read 4, write 2 and execute 1, so 7 is 4+2+1 (rwx) and 5 is 4+1 (r-x). So 755 means rwx for the owner and r-x for the group and others (rwxr-xr-x).
Changing the numbers and seeing how they look in binary makes it easy to understand how permissions and bit flags combine.
Ordinary calculators can get the last digits wrong with very large numbers, but this tool calculates large numbers exactly. However, the way computers store negative numbers (two's complement) and binary representation of fractions vary by system, so please treat this tool as an ordinary base conversion of number notation.
From the right end, assign each digit a power of 2 (1, 2, 4, 8, 16 and so on) and add up the values of the places that hold a 1.
For example, 1011 is 8 + 0 + 2 + 1 = 11, and 11010 is 16 + 8 + 0 + 2 + 0 = 26.
1011
Value added
The sum for 1011 is 8 + 2 + 1 = 11. If you set the base of the number you enter to 2 in this tool, you can check the same result.
Keep dividing the decimal number by 2, write down the remainders, and read the remainders from bottom to top to get the binary number.
Taking 13 as an example: 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Reading the remainders in reverse gives 1101.
Converting to octal or hexadecimal works the same way. Divide by 8 or 16 instead of 2, and write remainders of 10 or more as letters such as A, B and C.
16 is 2 to the 4th power, so 4 binary digits correspond exactly to 1 hexadecimal digit. That means you only need to split into groups, with no calculation.
For example, splitting binary 10101111 into groups of 4 gives 1010 and 1111, which are A and F, so the hexadecimal is AF. In decimal that is 10 × 16 + 15 = 175.
For the same reason, 3 binary digits correspond to 1 octal digit. Turning on this tool's readable grouping shows binary and hexadecimal split into groups of 4, which makes it easy to check by eye.
0
1
2
3
4
5
6
7
Split the 6 digits of the color code into pairs and convert each pair to decimal to get the red, green and blue values. Each value is between 0 and 255.
For example, #FF8000 has FF = 255, 80 = 128 and 00 = 0, so it is RGB(255, 128, 0). #1E90FF has 1E = 30, 90 = 144 and FF = 255, so it is RGB(30, 144, 255).
A prefix marks which base the number that follows is in: 0x is hexadecimal, 0b is binary and 0o is octal.
This tool strips the prefix and reads the number only when the prefix matches the selected base. For example, if the base of your input is 16 and you enter 0xFF, it reads FF, but if the base is 10 and you enter 0xFF, it tells you that x cannot be used.
If you want the result to carry a prefix, turn on adding prefixes such as 0x and 0b. It is convenient when pasting straight into code.
In C-family languages, a leading 0 alone makes the number read as octal. Be careful that 010 is 8, not 10.
The size of a number determines how many bits it needs, and 8 bits make 1 byte. This tool shows the bit count and byte count of the number you enter when written in binary.
255 is 11111111 in binary, 8 bits, so it fits exactly in 1 byte, while 256, one more, is 9 bits and needs 2 bytes. 65535 is 16 bits, the maximum for 2 bytes.
1 byte
2 bytes
4 bytes
If the number you enter is between 32 and 126, the tool also shows the ASCII character with that number. This is because numbers are also used as character codes.
ASCII is a rule that assigns numbers to Latin letters, digits and symbols. Hangul uses Unicode numbers outside this range, so it does not appear in this field.
A
a
0
Space
Uppercase and lowercase letters differ by 32 in decimal, and by just one bit in binary.
It uses all of the digits 0–9 and the letters a–z to write numbers with fewer digits, and is often used for short IDs and short-URL codes.
For example, zz in base 36 is 35 × 36 + 35 = 1,295. A four-digit decimal number shrinks to two characters.
Choose a base from 2 to 36 in the custom pick of the tool and the results in the other bases appear at once. Uppercase and lowercase are not distinguished and are read as the same value.
This tool converts integers only. Fractions may not come out exactly in every base, so a precise conversion rule would have to be defined separately.
A well-known example is 0.1. It is simple in decimal but an endless sequence in binary, so when a computer calculates 0.1 + 0.2 it gets a tiny error such as 0.30000000000000004.
That is why, where errors are unacceptable, such as with money, calculations are done in whole units (won, cents) instead of fractions.
Spaces, commas and underscores are ignored automatically, and a leading + or - sign is read. You can paste long numbers that were written in groups as they are.
For example, binary 1010 1111 or decimal 1,000,000 are read as they are. If a character can't be used in the selected base, the tool tells you which character is the problem.
Most languages have built-in functions to read and write strings in a given base, so it is a good idea to compare with this tool when checking your results.
Hex string → decimal
Decimal → binary string
Decimal → hex string
Decimal → octal string
Ordinary JavaScript numbers lose accuracy above about 9 quadrillion. For very large numbers you need BigInt to be exact, and this tool calculates that way.
Each number in an IP address is an 8-bit value from 0 to 255, so converting the four dot-separated numbers to 8 binary digits each gives a 32-bit address.
For example, 192 is 11000000 and 168 is 10101000. So an address starting with 192.168 starts with 11000000.10101000 in binary.
The same principle explains why the subnet mask 255.255.255.0, which is 24 ones in a row in binary, gives a prefix length of /24.
One byte can be written exactly in two characters, so computer-related values are often written in hexadecimal.
When the result looks wrong, the most common cause is not the calculation but choosing the wrong base for the number you entered.
Knowing just a few powers of 2 speeds up bit and capacity calculations. The maximum value is the power minus 1: 255 for 8 bits and 65,535 for 16 bits.
This is also why 1,024, which is 2 to the 10th, is used as the kilo unit, and why 1,000 and 1,024 are mixed in computer capacity calculations. It is the same reason storage-device labels and what an operating system shows look different.
2 to the 4th
2 to the 8th
2 to the 10th
2 to the 16th
2 to the 32nd