Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal
About This Tool
Numbers can be represented in any positional base. Decimal (base 10) is conventional; binary (base 2) underpins digital logic; octal (base 8) appears in Unix permissions; hexadecimal (base 16) compresses binary into 4-bit groups for human reading.
Enter a number in any of those four bases and the converter returns equivalents in the others. It accepts standard prefixes (0b for binary, 0o for octal, 0x for hex) and rejects digits outside the input base.
The conversion is mechanical. Decimal to base-N: repeatedly divide by N and collect remainders, reading bottom up. Base-N to decimal: multiply each digit by N raised to its position power, summing left to right. Hex to binary is direct (each hex digit maps to 4 bits) which is why hex is the preferred human-readable form for binary data. Octal to binary maps each digit to 3 bits — once dominant for Unix permissions because three-bit chunks align cleanly with read/write/execute triples. The four standard bases (2, 8, 10, 16) cover essentially all programmer use cases. Base 36 (alphanumeric) and base 64 (with =/+ padding) appear for compact identifiers and binary-to-text encoding respectively, but the converter sticks to the standard four.
A worked example. Decimal 255. To binary: 255/2=127 r1, 127/2=63 r1, 63/2=31 r1, 31/2=15 r1, 15/2=7 r1, 7/2=3 r1, 3/2=1 r1, 1/2=0 r1. Read bottom up: 11111111. To hex: 255 = 15×16 + 15 = FF. To octal: 255 = 3×64 + 7×8 + 7 = 377. So 255 = 0b11111111 = 0xFF = 0o377. The hex/binary correspondence is visible: FF is two hex digits, eight binary bits, four-bit groups (1111 1111). This tight grouping is why hex dominates for memory addresses, network protocols, and color codes.
Limitations and pitfalls. Negative numbers are the awkward case. Decimal handles them with a minus sign; binary and hex in real systems use two's complement, which depends on bit width. -5 in 8-bit two's complement is 11111011, which is also 251 unsigned. The same bit pattern means different things depending on signedness. Most converters return signed magnitude (-5 in binary as -101) rather than two's complement. Fractional numbers are similar — base-N representation of decimal 0.1 doesn't terminate in binary (it's 0.0001100110011...), which is the root cause of floating-point arithmetic surprises. The converter handles integers cleanly and is silent on fractions, which is the right scope for most use cases.
The about text and FAQ on this page were drafted with AI assistance and reviewed by a member of the Coherence Daddy team before publishing. See our Content Policy for editorial standards.