Convert between binary, octal, decimal, hexadecimal, and other numeral systems

Convert numbers and calculations between these numeral systems:

  • Binary (base 2, bin, bit)
  • Ternary (base 3, trit)
  • Quaternary (base 4)
  • Octal (base 8, oct)
  • Duodecimal (base 12)
  • Hexadecimal (base 16, hex; one digit represents four bits)
  • Vigesimal (base 20)
  • Base 36

Hexadecimal values with a 0x prefix and binary values with a 0b prefix are detected automatically.

Calculations support +, -, *, x, / and parentheses. All values in a calculation use the selected input system. In base 36, use * for multiplication because x is a valid digit.


 

Note on negative numbers and fractional precision

Negative numbers
Negative values use a leading minus sign (for example, decimal -10 is binary -1010). This is mathematical signed notation rather than a fixed-width binary encoding such as two's complement.

Fractions and precision
Calculations use exact rational arithmetic. When a fractional result repeats, the displayed value is rounded to a maximum of 12 fractional digits in decimal and 10 in other bases.