Toolminex
Developer Tools

Binary / Hex / Octal Converter

Convert numbers between binary, decimal, hexadecimal, and octal instantly. All four bases, bidirectional, with step-by-step breakdown.

Runs in browserFree & no signupAll 4 number bases
0b
0x
0o

How to convert between binary, decimal, hex and octal

Type a number in any base and read it in the other three.

  1. 01

    Type into any of the four boxes

    Decimal, binary, hexadecimal or octal. The other three fill in as you type, so you can start from whichever base you have.

  2. 02

    Leave out prefixes

    Type FF rather than 0xFF, and 1010 rather than 0b1010. Hex accepts upper or lower case; only decimal accepts a minus sign.

  3. 03

    Copy the base you need

    Each box has its own copy button. Binary is padded with leading zeros to whole groups of four bits, at least one byte, with the bit and byte count shown underneath.

How the bases relate

Each base uses a different number of digits. Decimal uses 10, binary 2, octal 8 and hexadecimal 16, with A to F standing for 10 to 15. One hex digit is exactly four binary digits and one octal digit is exactly three, which is why programmers use hex as a short way of writing binary.

DecimalBinaryHexOctal
101010A12
151111F17
161 00001020
100110 010064144
2551111 1111FF377
2561 0000 0000100400
1,024100 0000 00004002000
65,5351111 1111 1111 1111FFFF177777

255, FF in hex, is the largest value in one byte, which is why it appears in colour codes like #FFFFFF and in network masks like 255.255.255.0. A worked conversion: 100 in binary is 64 + 32 + 4 = 1100100.

Big numbers and negative numbers

The converter uses JavaScript's BigInt, so it's exact for any whole number you type, however long. 9,007,199,254,740,993 converts correctly, even though ordinary JavaScript numbers can't hold it exactly and would round it to …992.

Negative decimals are shown with a minus sign in every base: −10 is −1010 in binary and −A in hex. That's the mathematical value, not the two's-complement form a computer stores. In 8-bit two's complement, −10 is 1111 0110; to get that, add 256 to the negative number (−10 + 256 = 246) and convert 246.

Powers of two worth remembering

Binary place values double from right to left: 1, 2, 4, 8, 16 and so on. A handful of them come up so often in computing that they're worth knowing by heart:

PowerValueWhere you'll see it
2⁸256Values in one byte (0 to 255); colour channels
2¹⁰1,024One kibibyte (KiB)
2¹⁶65,536Port numbers (0 to 65,535); 16-bit audio levels
2²⁰1,048,576One mebibyte (MiB)
2²⁴16,777,216Colours in 24-bit RGB
2³²4,294,967,296IPv4 addresses; 32-bit integer range
2⁶⁴18,446,744,073,709,551,61664-bit integer range

To convert decimal to binary by hand, keep dividing by 2 and write down the remainders, then read them from bottom to top. 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1, giving 1101.

Where base conversion comes up

Reading hex colour values

Convert each pair of a colour code to decimal: #3B82F6 is 59, 130 and 246 for red, green and blue.

Working out permissions and flags

Unix file mode 755 is octal for binary 111 101 101: read, write and execute for the owner, read and execute for everyone else.

Checking homework or exam answers

Type the decimal number and see the binary, octal and hex answers side by side.

Frequently asked questions

No. The conversions are done by your browser as you type.
No. The converter handles whole numbers only. Fractions in binary, such as 0.1, often repeat forever and need a separate method.
Leading zeros don't change the value; they group the bits into fours and whole bytes so the number is easier to read. 5 shows as 00000101.
This tool converts numbers. For text, each character is first turned into its code, such as 65 for A, and that number is converted.
No practical one. Numbers are handled as BigInt, so a 100-digit decimal converts exactly, though very long binary strings get hard to read.

Related tools

Something not working right?