$devtoolkit.sh/examples/math/binary-conversion

Binary, Decimal, and Hex Conversion

Understanding number base conversions is fundamental to low-level programming, networking, and computer science. Binary (base-2), decimal (base-10), hexadecimal (base-16), and octal (base-8) all represent the same values in different notation systems. This collection shows conversions for common programming values: byte boundaries, permission bits, and color components. The binary-to-decimal converter shows each step of the positional weighting calculation so you can internalize the pattern rather than just looking up the result.

Example
# Decimal to Binary
255 = 11111111 (0xFF, 8 bits all set)
128 = 10000000 (0x80, high bit)
127 = 01111111 (0x7F, max signed byte)
64  = 01000000 (0x40)
32  = 00100000 (0x20)

# Unix permissions
777 (octal) = 111 111 111 (binary) = rwxrwxrwx
644 (octal) = 110 100 100 (binary) = rw-r--r--
755 (octal) = 111 101 101 (binary) = rwxr-xr-x
[ open in Binary to Decimal → ]

FAQ

Why do computers use binary instead of decimal?
Electronic circuits have two stable states: on and off, which map naturally to 1 and 0. Binary arithmetic can be implemented with simple logic gates, making it far more practical than base-10 for hardware.
Why is hexadecimal used in programming?
Each hex digit represents exactly 4 bits, so two hex digits represent one byte. This makes hex a compact and readable way to express binary data, memory addresses, and color values.
How do I convert hex to binary?
Replace each hex digit with its 4-bit binary equivalent: 0=0000, 1=0001, ..., A=1010, ..., F=1111. For example, 0xFF = 1111 1111 and 0xA3 = 1010 0011.

Related Examples

/examples/math/binary-conversionv1.0.0