Binary / Decimal / Hex Converter

Convert between binary, decimal, hexadecimal & octal · step-by-step · IEEE 754 · bitwise · ASCII

Type in any field — all others update instantly. Paste 0x, 0b, or 0o prefixes for auto-detection.

Base 10
Base 2
Base 16
Base 8

Binary, Decimal, Hex & Octal — The Four Number Systems

Computers represent all data in binary (base 2), but engineers frequently need to read values in hexadecimal (base 16) for compactness, decimal (base 10) for human-readability, or octal (base 8) for UNIX permissions and legacy systems. This converter handles all four bases simultaneously — type in any field and the other three update instantly.

How to Use This Converter

  • Type a number in any of the four fields — Decimal, Binary, Hex, or Octal.
  • Paste with a prefix: 0xFF auto-detects hex, 0b1010 binary, 0o17 octal.
  • Use the Advanced tab for step-by-step breakdowns, two's complement, IEEE 754 float representation, bitwise operations, and the full ASCII table.
  • Click the copy icon next to any field to copy the value to your clipboard.
  • Negative numbers are supported — prefix with a minus sign.

Key Conversion Formulas

Decimal → Binary (divide by 2)

Repeatedly divide the decimal number by 2, recording the remainder at each step. Read the remainders from bottom to top to get the binary representation.

Example: 13 → 1101₂  (13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → read bottom-up: 1101)

Binary → Decimal (positional weights)

Multiply each bit by its positional weight (2^n, where n is the bit position from the right, starting at 0) and sum all contributions.

Example: 1101₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13

Hex ↔ Binary (groups of 4 bits)

Each hex digit maps directly to exactly 4 binary bits (a nibble). No arithmetic needed — substitute each hex digit with its 4-bit binary equivalent.

HexDecimalBinary (4-bit)
000000
440100
881000
A101010
F151111
FF2551111 1111

What is Two's Complement?

Two's complement is the standard way computers represent signed integers. To negate a number: invert all bits (one's complement), then add 1. An 8-bit signed integer ranges from −128 to +127; unsigned from 0 to 255. The Advanced tab shows the two's complement representation for 8, 16, 32, and 64-bit widths.

IEEE 754 Floating Point

The IEEE 754 standard defines how floating-point numbers are stored in binary. A 32-bit (single-precision) float uses 1 sign bit, 8 exponent bits, and 23 mantissa bits. The Advanced tab visualises the exact bit layout for any decimal number you enter, including the biased exponent value.

Frequently Asked Questions

How do I convert binary to decimal?
Multiply each binary digit by 2 raised to its position (starting from 0 on the right) and sum the results. For example, 1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11. The Advanced tab shows the full positional-weight table automatically when you enter a binary number.
Why is hexadecimal used in programming?
Each hex digit represents exactly 4 binary bits, so hex is a compact, human-readable shorthand for binary data. A byte (8 bits) is always exactly 2 hex digits (00–FF). This makes hex ideal for memory addresses, colour codes (#RRGGBB), bitmasks, and processor instructions.
What is the maximum number this converter handles?
The converter uses JavaScript's native number type, which safely represents integers up to ±2^53 − 1 (approximately ±9 quadrillion). Numbers outside this range trigger a safe-integer warning. For larger values, BigInt-based tools are recommended.
How do I convert a negative number to binary?
Type the minus sign first, e.g. −13. The converter shows the magnitude in binary. For the two's complement representation used by actual hardware, see the Bit-Width Analysis section in the Advanced tab — it shows the exact bit pattern for 8, 16, 32, or 64-bit widths.
What are bitwise operations?
Bitwise operations (AND, OR, XOR, NOT, left shift, right shift) act on individual bits of integers. AND sets a bit only if both inputs have it set; OR if at least one does; XOR if exactly one does. Shifts multiply or divide by powers of 2. They are widely used in embedded systems, graphics, cryptography, and performance-critical code.

Related Calculators