Hex Converter

Converting between number bases follows positional notation rules: each digit is multiplied by its base raised to a positional power. Hexadecimal (base 16) uses digits 0-9 and letters A-F, binary (base 2) uses only 0 and 1, and octal (base 8) uses digits 0-7. For example, the decimal number 255 equals FF in hexadecimal, 11111111 in binary, and 377 in octal. Enter a value in any field below to convert to all other bases instantly.

Quick Answer

Decimal 42 converts to 2A in hexadecimal, 101010 in binary, and 52 in octal.

Digits 0-9 and letters A-F

Digits 0 and 1 only

Digits 0-7 only

Common Examples

Input Result
Decimal 255 Hex FF, Binary 11111111, Octal 377
Hex 1A Decimal 26, Binary 11010, Octal 32
Binary 1100100 Decimal 100, Hex 64, Octal 144
Decimal 0 Hex 0, Binary 0, Octal 0
Octal 777 Decimal 511, Hex 1FF, Binary 111111111

How It Works

The Formula

Every number system uses positional notation. A number in base B with digits d(n), d(n-1), …, d(1), d(0) has the decimal value:

value = d(n) x B^n + d(n-1) x B^(n-1) + … + d(1) x B^1 + d(0) x B^0

To convert from any base to decimal, multiply each digit by its positional power and sum the results. To convert from decimal to another base, repeatedly divide by the target base and collect the remainders.

Decimal (Base 10): The standard number system using digits 0 through 9. Each position represents a power of 10.

Hexadecimal (Base 16): Commonly used in computing for memory addresses and color codes. Uses digits 0-9 and letters A-F (where A = 10, B = 11, C = 12, D = 13, E = 14, F = 15).

Binary (Base 2): The fundamental number system of computers. Each digit (called a bit) is either 0 or 1. Eight binary digits form one byte.

Octal (Base 8): Uses digits 0 through 7. Historically popular in computing because each octal digit maps to exactly three binary digits, making it a compact way to represent binary data.

Worked Example

To convert decimal 200 to hexadecimal: divide 200 by 16 to get 12 remainder 8. Then divide 12 by 16 to get 0 remainder 12 (which is C in hex). Reading the remainders from bottom to top gives C8. Verification: C (12) x 16 + 8 x 1 = 192 + 8 = 200.

To convert decimal 200 to binary: 200 / 2 = 100 r 0, 100 / 2 = 50 r 0, 50 / 2 = 25 r 0, 25 / 2 = 12 r 1, 12 / 2 = 6 r 0, 6 / 2 = 3 r 0, 3 / 2 = 1 r 1, 1 / 2 = 0 r 1. Reading remainders from bottom to top: 11001000.

To convert hex C8 to octal: first convert to decimal (200), then to octal. 200 / 8 = 25 r 0, 25 / 8 = 3 r 1, 3 / 8 = 0 r 3. Result: 310.

Related Calculators

Frequently Asked Questions

Why is hexadecimal used in programming?
Hexadecimal is compact and maps cleanly to binary. Each hex digit represents exactly four binary digits (bits), so one byte (8 bits) is always two hex digits. This makes hex ideal for representing memory addresses, color codes (like #FF5733), and raw binary data in a human-readable format.
How do I convert binary to hexadecimal manually?
Group the binary digits into sets of four, starting from the right. Pad the leftmost group with zeros if needed. Then convert each group of four bits to its hex equivalent. For example, binary 11010110 becomes 1101 0110, which is D6 in hex.
What is the largest value one byte can hold?
One byte is 8 binary digits, so the maximum value is 11111111 in binary, which equals 255 in decimal and FF in hexadecimal.
What is the difference between hexadecimal and octal?
Hexadecimal is base 16 and uses digits 0-9 plus letters A-F. Octal is base 8 and uses digits 0-7. Hex is more common in modern computing because it aligns with byte boundaries (two hex digits per byte), while octal was historically used in older systems where word sizes were multiples of three bits.
Can this converter handle negative numbers?
This converter works with non-negative integers. Negative numbers in computing are typically represented using two's complement notation in binary, which depends on the specific bit width (8-bit, 16-bit, 32-bit, etc.).