<link rel="stylesheet" type="text/css" href="/mirawhite.css">

Binary, decimal, hex and octal converter

Type a number in any field: the others update instantly. This free converter keeps large numbers exact and can show negatives in two’s complement. Nothing is sent to a server.

Free, no sign-up, no limit Runs in your browser: your text and files are never sent or saved.

Binary, decimal, hex converter

Options

How to use it

  1. Type a number in the binary, octal, decimal or hexadecimal field, or try the example.
  2. Read the result in the other bases; add a custom base (2 to 36) if needed.
  3. Choose the display (digit groups, 0b/0x prefixes, two’s complement), and open the calculation detail to see each step.

Example

Input

2025 (decimal)

Output

Binary: 0111 1110 1001
Octal: 3751
Decimal: 2025
Hexadecimal: 07 E9

Good to know

  • Whole numbers only: fractions such as 0.1 are not converted.
  • Without two’s complement, negative numbers keep a minus sign in every base.
  • In two’s complement mode, binary, octal and hexadecimal fields are read as bit patterns of the chosen width: FF on 8 bits means −1.
  • Calculations run in your browser: nothing is sent or stored.

How number bases work

In base b, each digit is multiplied by a power of b that grows by one from right to left. In decimal, 2025 = 2 × 1000 + 0 × 100 + 2 × 10 + 5. In binary (base 2) the powers are 1, 2, 4, 8, 16…; in hexadecimal (base 16) they are 1, 16, 256, 4096…, and the digits 10 to 15 are written A to F.

Because 16 = 2⁴ and 8 = 2³, one hex digit stands for exactly 4 bits and one octal digit for 3 bits. That is why programmers read binary in hex: a byte is always two hex digits, from 00 to FF (0 to 255).

Frequently asked questions

How do I convert binary to decimal?

Give each bit the value of its power of 2, from 1 on the right (1, 2, 4, 8, 16…), and add the values of the bits set to 1. For 1011: 8 + 0 + 2 + 1 = 11. Type the binary number in the Binary field and the decimal value appears at once.

How do I convert decimal to binary?

Divide by 2 again and again, noting each remainder, until you reach 0, then read the remainders from last to first. For 13: 13 → 6 r1, 6 → 3 r0, 3 → 1 r1, 1 → 0 r1, so 1101. The converter does it instantly, however large the number.

How do I convert binary to hexadecimal?

Group the bits by 4 from the right, then replace each group with one hex digit (0000 = 0 … 1001 = 9, 1010 = A … 1111 = F). 0111 1110 1001 gives 7E9, which is 2025 in decimal. For octal, group the bits by 3 instead.

Can it convert binary numbers with a decimal point?

No, the converter handles whole numbers only. By hand, the bits after the point are worth 1/2, 1/4, 1/8 and so on: 0.101 in binary is 0.5 + 0.125 = 0.625. Many decimal fractions, such as 0.1, have no exact binary form.

What is two’s complement?

The way computers store negative integers on a fixed number of bits: invert every bit of the positive value and add 1. On 8 bits, −1 is 1111 1111 (FF) and −128 is 1000 0000. Tick “Negative numbers in two’s complement” and choose 8, 16, 32 or 64 bits.

How large a number can it convert?

Numbers of any practical size stay exact, digit for digit, because the tool uses arbitrary-precision integers rather than floating point. The bit size of the value is shown, and the two’s complement mode checks that it fits in the width you chose.

← Back to all tools