Number Base Converter — Binary, Octal, Decimal & Hex

Convert any number between binary, octal, decimal, and hexadecimal. All four bases shown simultaneously.

  • Binary, octal, decimal, hex
  • All bases at once
  • Copy each result
  • Browser-only
Binary (base 2)
11111111
Octal (base 8)
377
Decimal (base 10)
255
Hexadecimal (base 16)
FF

How this tool fits your workflow

More in this category →

How positional number systems work

Every positional number system uses a base (radix). Decimal (base 10) uses digits 0-9. Binary (base 2) uses 0-1. Octal (base 8) uses 0-7. Hexadecimal (base 16) uses 0-9 plus A-F for values 10-15. The position of each digit represents a power of the base: rightmost is base^0, next is base^1, and so on.

Example: decimal 255 = 2 times 10^2 + 5 times 10^1 + 5 times 10^0. Binary 11111111 = sum of 2^7 through 2^0 = 255. Hex FF = 15 times 16 + 15 = 255. All three represent the same value.

Practical uses in programming

Hex is everywhere in low-level programming: memory addresses (0x7FFE4C2B), byte masks (0xFF), CSS color values (#3B82F6 = R:59, G:130, B:246), and bitwise operations. Binary is used when individual bits matter: permission flags, protocol headers, and bitwise AND/OR operations.

Octal still appears in Unix permissions. chmod 755 sets owner=rwx (7=111 in binary), group=r-x (5=101), others=r-x (5=101). Understanding the octal-to-binary relationship makes permission strings intuitive.

Frequently asked questions

How do I convert decimal to binary?
Repeatedly divide by 2 and record remainders bottom to top. For 25: 25/2=12R1, 12/2=6R0, 6/2=3R0, 3/2=1R1, 1/2=0R1. Read remainders bottom to top: 11001.
Why do programmers use hexadecimal?
Each hex digit represents exactly 4 binary bits, making hex a compact human-readable representation of binary data. Two hex digits equal one byte. Memory addresses, color codes, and binary file data are naturally expressed in hex.
What is octal used for?
Octal mainly appears in Unix file permissions (chmod 755 means rwxr-xr-x). Each octal digit represents 3 binary bits.
Can this converter handle negative numbers?
Yes. Negative numbers show with a minus sign in all bases. For two's complement (how computers store negatives), the representation for -N in n bits is (2^n) - N.