How number bases work
A base (or radix) is how many digits a number system uses. Decimal uses ten (0–9), binary two (0 and 1), octal eight (0–7) and hexadecimal sixteen (0–9 then A–F). Each position is worth the base times the position to its right, so hex 2F is 2 × 16 + 15 = 47.
Where you meet each base
- Binary: bit flags, network masks, bitwise operations and hardware registers.
- Hexadecimal: colours (
#2F6FED), memory addresses, byte dumps, hashes and UUIDs. One hex digit is exactly four bits, so two digits make a byte. - Octal: mainly Unix file permissions (
chmod 755). - Base 36: compact IDs and short links, since it uses every digit and letter.
Negative numbers and two's complement
Computers store negative integers in two's complement: the value −1 in 8 bits is 11111111 (0xFF), the same bits as unsigned 255. The table above shows both readings for 8, 16, 32 and 64-bit widths whenever the number fits. This explains why a byte read from a file might show as −56 in Java (whose byte is signed) but 200 elsewhere.
Converting in code
- JavaScript:
(255).toString(16)andparseInt('ff', 16); useBigIntfor values beyond 253. - Java:
Integer.toBinaryString(n),Long.parseLong("ff", 16), ornew BigInteger(s, 36). - Python:
bin(n),hex(n),oct(n)andint('ff', 16).
Frequently asked questions
How do I convert binary to decimal?
Type or paste the binary number into the Binary box; the decimal value appears immediately. By hand, add the powers of two where there is a 1: 1011 = 8 + 0 + 2 + 1 = 11.
Is there a size limit?
No. The converter uses arbitrary-precision integers, so numbers with hundreds of digits convert exactly, without the rounding you get beyond 2^53 in ordinary JavaScript numbers.
Can I paste values with 0x or 0b prefixes?
Yes. 0x, 0b and 0o prefixes are accepted, as are spaces, underscores and commas used as digit separators.
Does it convert fractions?
No, only whole numbers (positive or negative). Fractions often have no exact representation in another base; for example 0.1 in decimal repeats forever in binary.
Is anything sent to a server?
No. Conversion happens in your browser.