RubanTools

Number Base Converter

Convert between decimal, binary, hexadecimal and octal - with 8/16/32-bit display and two's complement for negatives.

Convert
0x
0o
Bit-Width Display
Quick Reference
DecimalBinaryHexOctal

Base Conversion FAQ

One hex digit represents exactly 4 bits, so 2 hex digits represent 1 byte (8 bits). This makes hex much more compact than binary while maintaining a direct mapping - 0xFF = 11111111 in binary. Hex is used in memory addresses, color codes, bytecode, and bit masks.

Two's complement is the standard way to represent negative integers in binary. To negate a number: invert all bits (one's complement) and add 1. Example: −5 in 8-bit = NOT(00000101) + 1 = 11111010 + 1 = 11111011. The most significant bit (MSB) is the sign bit: 0 = positive, 1 = negative.

Octal (base 8) maps directly to 3 bits. It is primarily used in Unix/Linux file permission notation - e.g., chmod 755 means: owner=7 (rwx), group=5 (r-x), others=5 (r-x). Each octal digit (0–7) represents a combination of read (4), write (2), execute (1) permissions.