Hex, decimal, binary and octal converter

Convert a number between hexadecimal, decimal, binary and octal at any size.

Runs in your browser. Your input is not uploaded.

Loading the tool…

What it does

The same integer can be written in base 10 (decimal), 16 (hex), 2 (binary) or 8 (octal). Type in any field and the others update. Values are BigInts, so 64-bit and larger numbers convert exactly.

Prefixes (0x, 0b, 0o) and separators (_, spaces) are accepted. The tool also shows bit length and two’s complement at 8, 16, 32 and 64 bits.

How to use it

  1. Type a number in any base.
  2. Read the other bases.
  3. Tick Group digits to split long values into readable groups.

Example

Input
Hex FF
Output
Decimal 255, binary 11111111, octal 377

Things to watch for

  • A negative number in two’s complement depends on the width. -1 is FF in 8 bits and FFFFFFFF in 32.
  • Fractions are not supported.

Questions

How do I convert hex to decimal?
Type the hex value in the Hex field, with or without 0x. The decimal value appears straight away.
Is there a size limit?
No practical limit; values are arbitrary-precision integers.
What is two’s complement?
The way computers store negative integers: invert the bits of the positive value and add one. The tool shows it for common widths.
How is octal used?
Mostly for Unix file permissions. The chmod calculator explains those digits.