There are four boxes: Decimal (base 10), Binary (base 2), Octal (base 8) and Hexadecimal (base 16). Type a whole number into any one box. The other three boxes update as you type. Hex letters can be typed in upper or lower case. Hex results are always shown in upper case. For example, typing 45 in the Decimal box shows 2D in the Hex box. Leading zeros make no difference: binary 00001111 is decimal 15 and hex F. If you clear a box, the other boxes are cleared too.
In decimal, each place is worth 10 times the place to its right: ones, tens, hundreds. Other bases work the same way. Only the multiplier changes. In binary each place is worth 2 times the one to its right. In octal it is 8 times, and in hex 16 times. Let's convert binary 101101 to decimal:
| Place value | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|
| Binary digit | 1 | 0 | 1 | 1 | 0 | 1 |
| Digit × value | 32 | 0 | 8 | 4 | 0 | 1 |
Add the last row: 32 + 8 + 4 + 1 = 45. The same number in the other bases:
So 0b101101 = 45 = 0o55 = 0x2D. The 0b, 0o and 0x prefixes are how many programming languages mark binary, octal and hex. In hex, the letters A to F stand for the values 10 to 15.
Divide by 2 again and again, and write down each remainder. Then read the remainders from the bottom up:
For octal, divide by 8 instead. For hex, divide by 16.
One hex digit is exactly 4 binary digits (bits). One octal digit is exactly 3 bits. So you can convert without going through decimal. Split the binary number into groups, starting from the right. Add zeros on the left if needed:
#FF5733 is three hex pairs: FF = 255 red, 57 = 87 green, 33 = 51 blue. Our Color Converter does this for you.chmod 755 sets permissions with three octal digits: owner, group and everyone else. Each digit is 3 bits: read (4), write (2) and execute (1). 7 = 111 = read, write and execute. 5 = 101 = read and execute. In the tool, octal 755 is binary 111101101, which is exactly those nine permission bits, and decimal 493. The common file setting 644 (rw-r--r--) is decimal 420.The converter checks every character you type. If something does not belong, it says so in a red note under the boxes, and the other boxes stay empty. It never shows a result for a number it could not read fully.
.75.102 in the Binary box shows the note “2” is not allowed in Binary. Commas are not accepted either: type 1000, not 1,000. Short forms like 1e21 are not read.1010 1010 or 1_000_000. The spaces and underscores are ignored, so 1010 1010 is decimal 170.0b works in the Binary box, 0o in the Octal box and 0x in the Hex box, in upper or lower case. A prefix in the wrong box, such as 0x1F in the Decimal box, shows a note that tells you which box to use. In the Hex box, 0b12 is read as the hex number B12, because B is a hex digit. Results are shown without a prefix.Write the place values under the digits from the right: 1, 2, 4, 8, 16, 32 and so on. Add the place values where the digit is 1. For 101101 that is 32 + 8 + 4 + 1 = 45.
Yes, but only with a minus sign. Decimal −45 becomes −101101 in binary and −2D in hex. The tool does not show two's complement, which is how computers usually store negative numbers. In one signed byte, −45 is 11010011.
No. The tool works with whole numbers only. If you type 12.75, it shows a note instead of a result. Delete the .75 to convert 12, which is 1100 in binary.
No. The tool uses exact whole-number maths, so long numbers are not rounded. For example, hex FFFFFFFFFFFFFFFF, the largest 64-bit value, shows as 18446744073709551615 in decimal, which is exactly right.
Binary only has the digits 0 and 1, so the tool shows a note that says the 2 is not allowed, and the other boxes stay empty. Commas and decimal points also give a note. Spaces and underscores between digit groups are fine and are ignored.
Octal 755 is binary 111101101 and decimal 493. Split the binary into groups of three: 111 for the owner (read, write, execute), 101 for the group (read, execute) and 101 for everyone else (read, execute).