Simuveliq

Number system converter

Type a number in any base and get it in binary, octal, decimal, hexadecimal, BCD and Gray code with the repeated division and multiplication method, its one's and two's complement forms, binary addition and subtraction with carries and flags, and its IEEE 754 floating-point encoding.

What you can do

Frequently asked questions

How do you get the two's complement?

Invert every bit and add 1.

Guide: number systems, two's complement and IEEE 754

Computers store everything in binary. To program at a low level, design digital circuits or understand why 0.1 + 0.2 is not exactly 0.3, you need to convert between bases, represent negative numbers and know the floating-point format. This guide explains each step with worked examples.

Bases 2, 8, 10 and 16

In base b, each digit is worth its value times a power of b depending on its position. For example, 1001 1100₂ = 128 + 16 + 8 + 4 = 156. Octal (base 8) and hexadecimal (base 16, with digits 0–9 and A–F) are compact ways to write binary: each octal digit stands for 3 bits and each hexadecimal digit for 4.

Example 1: 156 to binary, octal and hexadecimal

  1. Repeated division by 2: 156 → 78 remainder 0 → 39 r 0 → 19 r 1 → 9 r 1 → 4 r 1 → 2 r 0 → 1 r 0 → 0 r 1. Reading the remainders from bottom to top: 1001 1100₂.
  2. Hexadecimal: groups of 4 bits from the right: 1001 | 1100 = 9 | C, that is, 9C₁₆.
  3. Octal: groups of 3 bits: 10 | 011 | 100 = 2 | 3 | 4, that is, 234₈.

Example 2: fractions

The fractional part is multiplied by 2, taking the integer part at each step: 0.625 × 2 = 1.25 → 1; 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1. So 0.625 = 0.101₂ = 0.5₈ = 0.A₁₆. Some simple decimal fractions, such as 0.1, have no finite binary representation: they repeat forever, which is why computers round them.

Negative numbers with n bits

Example 3: overflow

100 + 50 with 8 bits in two's complement: 0110 0100 + 0011 0010 = 1001 0110. Unsigned it is 150, correct; but signed, that pattern is −106. There was overflow: two positive numbers gave a negative result, because 150 does not fit in the range −128…127. The processor detects it with the V flag, the exclusive OR of the carry into the sign bit and the carry out of it.

Example 4: 32-bit IEEE 754 floating point

A number is stored as sign (1 bit), exponent with excess 127 (8 bits) and mantissa (23 bits), with an implicit leading 1. For 0.15625:

  1. Positive sign: 0.
  2. In binary, 0.15625 = 0.00101₂ = 1.01 × 2⁻³.
  3. Stored exponent: −3 + 127 = 124 = 0111 1100.
  4. Mantissa: the bits after the 1., that is, 01 followed by zeros.
  5. Result: 0 01111100 0100…0 = 0x3E200000.

Every value in these examples matches what the tool shows.

How to use the tool

  1. In "Base conversion", type the number (it accepts negatives and fractions, such as −45, 101.011 or 3F.8), its base and the number of bits.
  2. Read the result in every base (also BCD and Gray code), the signed representations and the steps: repeated division, multiplication of the fraction and bit grouping.
  3. In "Binary arithmetic", add or subtract with n bits and look at the carries and the C, V, N and Z flags.
  4. In "IEEE 754", type a decimal or a 0x… pattern to see its fields.

Common mistakes

Further reading

M. M. Mano and M. D. Ciletti, Digital Design (Pearson); D. A. Patterson and J. L. Hennessy, Computer Organization and Design (Morgan Kaufmann); the IEEE 754 standard. Simuveliq is not affiliated with these authors, publishers or IEEE.

More tools

Versión en español

© 2026 Simuveliq. All rights reserved.