DevSwitch.net
Back to Tools
#

Number System Converter

Convert between Binary, Decimal, Hexadecimal, and Octal - Edit any field to update all others

Number Converters

Tip: Type in any field and all other number systems will update automatically in real-time.

Runs in your browser

One number, four bases

Try

Convert between number bases

This number base converter keeps binary, decimal, hexadecimal and octal in step: type in any of the four fields and the other three are rewritten as you type. The strip under the fields lights the ones of the number, eight bits to a byte, for values up to 64 bits.

Every field accepts the prefix programmers write in code, 0b, 0o or 0x, and ignores spaces and underscores, so 0xFF_FF or 1111 0000 can be pasted as they are. Whole numbers of any length convert exactly.

Binary, octal, decimal and hex compared

SystemBaseDigitsPrefix in codeWhere you meet it
Binary 2 0 1 <code>0b1010</code> Bit flags, masks, network subnets
Octal 8 0-7 <code>0o12</code> Unix file permissions such as chmod 755
Decimal 10 0-9 - Everyday numbers, IDs, counts
Hex 16 0-9 A-F <code>0xFF</code> Colours like #FF8800, bytes, memory addresses

Octal and hex are shorthand for binary: one octal digit is exactly three bits and one hex digit exactly four, which is why a byte is always two hex digits.

Number system conversion chart

The first sixteen values, where hex runs out of single digits, and the landmarks you meet most:

DecimalBinaryOctalHex
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 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
16 10000 20 10
255 11111111 377 FF
256 100000000 400 100
4096 1000000000000 10000 1000
65535 1111111111111111 177777 FFFF

Convert one way, with the steps

When you only need one direction, each pair has its own converter that also writes out the working, division by division or bit group by bit group:

Number system questions

Any of them. The field you type in is the source, and the other three follow. A digit the base doesn't use, such as 2 in binary or G in hex, marks the field and leaves the others as they were.

Base 16 needs sixteen digits and there are only ten numerals, so A to F stand for 10 to 15. Upper and lower case mean the same; the converter writes upper case.

The minus sign is kept and the digits are the size of the number: -10 is -1010 in binary and -A in hex. Two's complement, the form a CPU stores, is not shown.

No practical one: the arithmetic is exact for whole numbers of any length. The bit strip shows numbers up to 64 bits.

No. The conversion runs in your browser.