Number Base Calculator

Convert instantly between binary, octal, decimal and hexadecimal, with a live bit-pattern diagram.
Convert

Convert Between Number Bases

Any base value = Σ (digit × baseposition)
255 (decimal)
11111111 (binary)
FF (hex)
A5 (hex)
Enter a value and press Convert.

Bit Pattern (live — shows binary place values)

The Four Number Bases Electronics Uses

Every number base represents the same quantity, just grouping digits differently. Decimal (base 10) is what humans use daily. Binary (base 2) is what digital hardware actually stores and computes with — every bit is either 0 or 1, matching a transistor's on/off state. Hexadecimal (base 16) is a compact shorthand for binary, since each hex digit represents exactly 4 bits (a "nibble") — making it far easier for humans to read and write long binary values like memory addresses or register contents. Octal (base 8), where each digit represents exactly 3 bits, was more common in older computing systems and is still occasionally seen in Unix file permissions.

BaseDigits usedBits per digitTypical use
Binary0-11What hardware actually stores/computes
Octal0-73Unix file permissions, legacy systems
Decimal0-9Everyday human-readable numbers
Hexadecimal0-9, A-F4Memory addresses, register values, color codes

Real-World Applications & Fully-Explained Examples

Worked examples — explained in full

1. 255 (decimal) to binary, octal and hex. Binary=11111111 (eight 1-bits, the maximum value for a byte). Octal=377. Hex=FF — the maximum value representable in one byte (8 bits) in any base.
2. 11111111 (binary) to decimal. 128+64+32+16+8+4+2+1=255 — summing each bit's place value (each a power of 2) where the bit is 1.
3. 1010 (binary) to decimal and hex. Decimal: 8+0+2+0=10. Hex: A (since hex digit A represents decimal 10).
4. FF (hex) to decimal and binary. Decimal: F×16+F=15×16+15=240+15=255. Binary: 11111111 — consistent with example 1, confirming FF, 255, and 11111111 all represent the identical value.
5. A5 (hex) to decimal. A×16+5=10×16+5=160+5=165.
6. 777 (octal, common Unix "full permissions" value) to decimal. 7×64+7×8+7×1=448+56+7=511 — representing "read+write+execute" permission bits for owner, group, and others all set.

Frequently Asked Questions

How do I convert binary to decimal?

Multiply each bit by its place value (a power of 2, starting from 2^0 on the right) and add the results. For example, 1010 = 1×8 + 0×4 + 1×2 + 0×1 = 10.

How do I convert hex to decimal?

Multiply each hex digit by its place value (a power of 16) and add the results, using A=10, B=11, C=12, D=13, E=14, F=15 for the letter digits. For example, FF = 15×16 + 15 = 255.

Why does electronics use hexadecimal instead of just binary?

Hexadecimal is a compact, human-readable shorthand for binary — each hex digit represents exactly 4 bits, so an 8-bit byte becomes just 2 hex digits (e.g. 11111111 = FF) instead of 8 hard-to-read binary digits.

What is the maximum value of a single byte?

255 in decimal, FF in hex, 11111111 in binary, and 377 in octal — all the same value, representing all 8 bits set to 1.

How do I convert octal to decimal?

Multiply each octal digit by its place value (a power of 8) and add the results. For example, 777 (octal) = 7×64 + 7×8 + 7×1 = 511.

What does a hex color code like #FF5722 mean?

It encodes red, green, and blue intensity as three hex byte pairs: FF (255, full red), 57 (87, some green), 22 (34, a little blue) — each pair ranges from 00 (none) to FF (255, maximum) for that color channel.

Why do Unix file permissions use octal (like chmod 755)?

Because each of the three permission groups (owner, group, others) uses exactly 3 bits (read/write/execute), and octal digits represent exactly 3 bits each — making one octal digit per permission group a natural, compact fit.

What is the largest number a given number of bits can represent?

2^n - 1 for n bits (unsigned): 1 bit gives 0-1, 4 bits give 0-15, 8 bits give 0-255, 16 bits give 0-65,535, and so on — each added bit doubles the range of representable values.

Do negative numbers work the same way in binary?

Not directly — computers most commonly use "two's complement" representation for signed (negative-capable) binary numbers, which is a specific encoding scheme beyond simple base conversion; this calculator handles unsigned (non-negative) base conversion.

How do I quickly convert hex to binary without full decimal conversion?

Convert each hex digit individually to its 4-bit binary equivalent and concatenate them — since each hex digit maps to exactly 4 bits, there's no need to go through decimal at all (e.g. hex "A5" = binary "1010" + "0101" = "10100101").

Related Calculators

Scientific CalculatorADC Resolution CalculatorAll Calculators