BL2.ru

Number System Converter Online

Enter a number, pick the source and target base from 2 to 36, and the calculator converts it (fractions included) and shows the solution the way you would write it on paper: division by the base, multiplication of the fractional part, positional expansion and the quick route with 3-bit and 4-bit groups.

Examples
Digits above 9 are letters A to Z (A = 10, B = 11, …, Z = 35), case does not matter. Separate the fractional part with a point or a comma, spaces are ignored. Digits after the point: 0 to 50; a fraction that does not convert exactly is cut off.
Calculate

What a number system is

In a positional system the value of a digit depends on its place. The base tells how many times the weight of neighbouring places differs. Decimal has base 10, binary 2, octal 8 and hexadecimal 16. When the base exceeds 10 there are not enough ordinary digits, so letters are used: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15, and so on up to Z = 35.

Converting a number to decimal

Write the number as a sum: multiply each digit by the base raised to the place number. Places of the integer part are numbered from the right starting at 0, places of the fractional part from the left starting at −1.

  • 1AF₁₆ = 1·16² + 10·16¹ + 15·16⁰ = 256 + 160 + 15 = 431.
  • 101.101₂ = 1·2² + 0·2¹ + 1·2⁰ + 1·2⁻¹ + 0·2⁻² + 1·2⁻³ = 4 + 1 + 0.5 + 0.125 = 5.625.

Converting a decimal integer to another base

Divide the number by the target base with remainder, then divide the quotient the same way, until the quotient is zero. The remainders written from bottom to top give the number in the new base.

Example: 37 to binary. 37 : 2 = 18 (remainder 1), 18 : 2 = 9 (0), 9 : 2 = 4 (1), 4 : 2 = 2 (0), 2 : 2 = 1 (0), 1 : 2 = 0 (1). Reading the remainders from bottom to top: 37 = 100101₂.

Converting the fractional part

Multiply the fractional part by the base. The integer part of the product is the first digit after the point, and the fractional part of the product is multiplied again. Stop when the fractional part becomes zero or when you have enough digits.

Example: 0.625 to binary. 0.625 · 2 = 1.25 (digit 1), 0.25 · 2 = 0.5 (digit 0), 0.5 · 2 = 1.0 (digit 1). So 0.625 = 0.101₂.

A finite decimal fraction does not have to be finite in another base. For example 0.1 in binary is infinite: 0.0001100110011…₂. That is why tasks state how many digits to keep, and the calculator cuts the result and tells you the answer is approximate.

Quick conversion between 2, 8 and 16

The bases 8 and 16 are powers of two (8 = 2³, 16 = 2⁴), so one octal digit equals three binary digits (a triad) and one hex digit equals four (a tetrad).

  • Binary to octal: split the number into groups of three from the point in both directions, pad with zeros if needed and replace each group with a digit. 1101011.01₂ = 001 101 011 . 010 = 153.2₈.
  • Binary to hex: the same with groups of four. 110101111₂ = 0001 1010 1111 = 1AF₁₆.
  • Back: replace each digit by its binary group.
  • Octal to hex and back is easiest through binary.

Common mistakes

  • Reading the remainders from top to bottom instead of bottom to top.
  • Using a digit that does not exist in the base (2 in binary, 8 in octal).
  • Numbering the places of the fractional part from 0 instead of −1.
  • Forgetting to pad the outer groups with zeros in the triad and tetrad method: zeros go on the left of the integer part and on the right of the fractional part.
  • Converting the fractional part by division instead of multiplication.

FAQ

How do I convert a decimal number to binary?
Divide the number by 2 with remainder, then keep dividing the quotient until you get 0. The remainders written from bottom to top are the binary form. For example 37 gives remainders 1, 0, 1, 0, 0, 1, which is 100101.
How do I convert a fractional number to another base?
Convert the integer and the fractional parts separately. Divide the integer part by the base, repeatedly multiply the fractional part by the base and write down the integer parts of the products from top to bottom. The calculator shows both tables.
Why can 0.1 not be converted to binary exactly?
A fraction has a finite expansion only if the denominator of its reduced form contains just prime factors of the base. 0.1 = 1/10 has the factor 5, which 2 does not have, so the binary expansion is infinite and periodic. That is why you set a precision.
Which letters are used for bases above 10?
Digits after 9 are Latin letters: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15, then G = 16 and so on up to Z = 35. That is why the largest base in the calculator is 36.
How do I quickly convert binary to hexadecimal?
Split the binary form into groups of 4 digits from right to left (pad the left with zeros) and replace each group with a digit from 0 to F. For octal use groups of 3.