๐Ÿ”ข Number Bases: A Programmer's Survival Guide

Binary, octal, decimal, hexadecimal โ€” and how to convert between them

Four Number Systems

BaseRadixSymbolsUse
Binary20, 1CPU, bitwise ops
Octal80โ€“7Unix permissions (chmod 755)
Decimal100โ€“9Everyday use
Hexadecimal160โ€“9, Aโ€“FColors, hashes, memory addresses
255 decimal = binary 11111111 = octal 377 = hex FF

One-Line Conversion

// JavaScript โ€” any base to any base
parseInt('FF', 16).toString(2)    // '11111111'
parseInt('11111111', 2).toString(10) // '255'

// Python
int('FF', 16)                     // 255
hex(255)                          // '0xff'
bin(255)                          // '0b11111111'

// Shell
echo "ibase=16; FF" | bc           // 255

๐Ÿ‘‰ Convert bases instantly

Binary, octal, decimal, hex โ€” real-time

๐Ÿ”ข Open Base Converter

FAQ

Q: Why binary?

Transistors have two states โ€” on/off. Binary maps directly to hardware.

Q: Hex Aโ€“F?

A=10, B=11, C=12, D=13, E=14, F=15.

๐Ÿ“– Related: SHA256 Hash โ†’ ยท Color Converter โ†’