Free tools for developers

Number Base Converter

Convert numbers between binary, decimal, octal and hexadecimal instantly. Type in any field and all others update automatically.

0–9
0–1
0–7
0–9, A–F

What is Number Base Conversion?

A number base defines how many digits a number system uses. Decimal uses ten digits from 0 to 9. Binary uses two digits, 0 and 1. Octal uses eight digits from 0 to 7. Hexadecimal uses sixteen digits, 0 to 9 plus A to F where A represents 10 and F represents 15. All four systems represent the same numbers just in different ways.

Computers work in binary at the hardware level because electronic circuits have two states, on and off. But binary numbers are long and hard for humans to read. A single byte needs 8 binary digits. Hexadecimal was developed as a compact human-readable representation of binary where each hex digit represents exactly four binary bits.

Binary (Base 2)

Binary is the native language of computers. Every number, character, image, and instruction stored in a computer is ultimately represented as a sequence of 0s and 1s. Understanding binary helps developers work with bitwise operations, understand memory layout, and debug low-level issues. The binary number 1010 equals decimal 10 because it has a 1 in the eights position and a 1 in the twos position: 8 + 2 = 10.

Hexadecimal (Base 16)

Hexadecimal is used constantly in programming. Memory addresses are shown in hex. Color codes in CSS like #FF5733 are hex values where FF is red, 57 is green, and 33 is blue. ASCII character codes, network addresses, and cryptographic hashes are all displayed in hex. Each hex digit represents exactly 4 binary bits so two hex digits represent one byte. This makes hex a compact and readable way to work with binary data.

Octal (Base 8)

Octal is most commonly used in Unix and Linux file permissions. The chmod command uses octal numbers to set permissions. 755 in octal means the owner has read, write, and execute permission (4+2+1=7) while group and others have read and execute permission (4+1=5). Octal was more commonly used in older computing systems and is less common today outside of Unix permissions.

How to Convert Between Bases

To convert decimal to binary, repeatedly divide by 2 and collect the remainders. To convert binary to hex, group the binary digits into groups of four from right to left and convert each group to a hex digit. To convert between any bases mentally, convert to decimal first as an intermediate step then convert from decimal to the target base. This tool does all conversions instantly so you do not need to do the arithmetic manually.

How to Use This Tool

  1. Type a number into any of the four input boxes.
  2. All other bases update automatically as you type.
  3. Click copy next to any field to copy that value to your clipboard.
  4. Use Load Sample to see example values for the number 255.

Frequently Asked Questions

Why do programmers use hexadecimal instead of decimal?

Because hex maps cleanly to binary. Each hex digit represents exactly 4 binary bits. So two hex digits represent one byte. This makes it easy to read and write binary data in a compact form. Decimal does not have this clean mapping to binary which makes it less useful for low-level programming work.

What does 0x mean before a number?

The 0x prefix indicates that a number is in hexadecimal format. For example 0xFF means the hex value FF which is 255 in decimal. This prefix is used in most programming languages including C, C++, Java, JavaScript, Python, and C# to distinguish hex literals from decimal numbers.

What does 0b mean before a number?

The 0b prefix indicates binary format. For example 0b1010 means the binary number 1010 which is 10 in decimal. This prefix is supported in Python, JavaScript, Java, C#, and most modern programming languages.

How many binary digits does a byte have?

A byte is exactly 8 binary digits (bits). The maximum value of a byte is 11111111 in binary, which is FF in hexadecimal, 377 in octal, and 255 in decimal. This is why you often see values ranging from 0 to 255 in computing contexts like RGB color values and network subnet masks.