Number Base Converter
Convert between binary, octal, decimal and hexadecimal — instantly.
0x hex · 0b binary · 0o octal · no prefix = decimalHow number bases work
A number base (or radix) defines how many digits a positional numeral system uses. Decimal (base 10) uses digits 0–9 and is the everyday standard. Binary (base 2) uses only 0 and 1 — it is the native language of computers, where each digit is one bit. Octal (base 8) uses digits 0–7 and was common in early Unix permissions (chmod 755). Hexadecimal (base 16) uses digits 0–9 and letters A–F, and is the dominant format for memory addresses, color codes (#FF5733), byte values, and binary file inspection because one hex digit maps exactly to 4 bits (one nibble) and two hex digits represent one byte.
Reading binary and hex in code
Most programming languages support numeric literals in multiple bases. In JavaScript, Python, Rust, and Go: 0b prefix for binary (0b1010), 0o for octal (0o755), and 0x for hexadecimal (0xFF). C and C++ use 0x for hex and 0 (bare leading zero) for octal. SQL uses X'...' or 0x notation for hex literals. You can also separate digits with underscores for readability in many languages: 0b1111_0000, 1_000_000, 0xFF_A0. The copy button here outputs the standard prefix form ready to paste into code.
Common conversions for developers
Unix file permissions are written in octal: 755 means rwxr-xr-x (7=111, 5=101 in binary). CSS and HTML colors use hex: #RRGGBB where each channel is one byte (00–FF). Network masks like 255.255.255.0 are 0xFFFFFF00 in hex, or 32 ones followed by zeros in binary. ASCII and Unicode code points are typically shown in hex: the letter A is 0x41 (decimal 65, binary 0100 0001). IPv4 addresses are sometimes written as 32-bit hex integers: 192.168.1.1 = 0xC0A80101.