Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Number Base Converter

Binary, octal, decimal, hex and every base to 36 — exact, with the working shown.

Math No upload Works offline Free, no sign-up

Any length. A dot starts the fraction (1010.101) and digits in brackets repeat (0.1(6)). Prefixes 0x, 0b and 0o work; spaces and underscores between digits are ignored.

Grouping: nibbles and bytes split binary into 4 or 8 bits and hexadecimal into bytes (2 digits); other bases are grouped in threes.

Try:

Result

— —

    In other bases

      Step by step

      In every base from 2 to 36
      BaseValue

      Next steps

      About the Number Base Converter

      Convert a number from any base from 2 to 36 to any other — binary, octal, decimal, hexadecimal, base 36 and everything between. Numbers can have thousands of digits and a fractional part: the value is kept as an exact fraction, so a fraction that never ends is shown with its repeating block (0.1 in binary is 0.0(0011), the digits in brackets repeating forever) instead of a rounded guess.

      The working is written out the way it is taught: each digit times its place value to reach decimal, repeated division by the new base for the whole part, and repeated multiplication for the fraction, with the step where the digits start to repeat marked. Between power-of-two bases the bit-group shortcut is shown too. For whole numbers you also get the 8-, 16-, 32- and 64-bit two’s complement, one’s complement and sign-magnitude forms, and what a bit pattern means when it is read as a signed number.

      How to use it

      1. Type the number. Use a dot for the fraction (1010.101) and brackets for repeating digits (0.1(6) means 0.1666…). Prefixes 0x, 0b and 0o work, and spaces or underscores between digits are ignored.
      2. Choose the From and To bases. The swap button turns the result back into the input, so you can check the conversion in reverse.
      3. Read the result as you type. Digits under a bar repeat forever and are copied in brackets. Set digit grouping (nibbles or bytes), lower-case letters and how many fraction digits to show.
      4. Follow the steps below the result. For whole numbers, check the signed forms at 8 to 64 bits, or how the same bits read as a signed number. Copy the result or download a summary.

      Examples

      Decimal to hexadecimal
      Input
      255 (base 10 → 16)
      Result
      FF

      255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15; both remainders are F.

      A fraction that never ends in binary
      Input
      0.1 (base 10 → 2)
      Result
      0.0(0011)

      0.1 = 1/10, and 10 has the prime factor 5, which 2 does not have — so the binary digits repeat forever.

      Binary to decimal
      Input
      1010.101 (base 2 → 10)
      Result
      10.625

      8 + 2 = 10 for the whole part; 1/2 + 1/8 = 0.625 for the fraction.

      Two’s complement
      Input
      −42 at 8 bits
      Result
      1101 0110

      256 − 42 = 214 = 11010110₂ — or flip the bits of 42 (0010 1010) and add 1.

      Reading a byte as a signed number
      Input
      11001000 (base 2)
      Result
      200 unsigned, −56 in two’s complement
      Base 36
      Input
      ZZ (base 36 → 10)
      Result
      1,295

      Z = 35, so ZZ = 35 × 36 + 35.

      Common uses

      • Programming: hex, binary and octal values, bit masks, signed bytes and 64-bit integers without rounding.
      • Computer science and digital electronics homework, with the division and multiplication working shown.
      • Checking why a decimal fraction such as 0.1 cannot be stored exactly in binary floating point.
      • Short identifiers in base 36, or exploring number systems such as ternary and duodecimal.

      How base conversion works

      In base b, each digit is worth b times the digit to its right: 1101 in binary is 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 13. Going the other way, divide the whole number by the new base again and again — the remainders are the digits, read from the last to the first. For a fraction, multiply by the new base again and again — the whole parts that appear are the digits, read from the first to the last (Knuth, The Art of Computer Programming, Vol. 2, §4.4).

      A fraction p/q in lowest terms ends in base b exactly when every prime factor of q also divides b. So 1/8 ends in binary (0.001) and 1/10 ends in decimal, but 1/10 repeats in binary and 1/3 repeats in both. A repeating block is never longer than q − 1 digits, and it is found here exactly: the tool stops when a remainder comes back.

      Signed numbers: two’s complement and the others

      • Two’s complement (used by almost all computers): −x is stored as 2ⁿ − x. In n bits it holds −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1, so 8 bits hold −128 to 127.
      • One’s complement: −x is stored with every bit of x flipped. It holds −(2ⁿ⁻¹ − 1) to 2ⁿ⁻¹ − 1 and has two zeros: all 0s and all 1s (“negative zero”).
      • Sign-magnitude: the top bit is the sign and the rest is the size, as in a written minus sign. It also has a negative zero (a 1 followed by 0s).

      In every format the top bit of a negative number is 1, which is why 1100 1000 can mean 200 (unsigned) or −56 (two’s complement): the bits are the same, only the reading differs.

      Digits above 9

      Bases above 10 use letters: A = 10, B = 11, … F = 15 in hexadecimal, up to Z = 35 in base 36. Upper and lower case mean the same. Data encodings such as Base32 and Base64 (RFC 4648) use different alphabets and work on bytes, not on one number — use the Base64 encoder for those.

      Limitations

      • Inputs can have up to 10,000 digits. Fractions are shown with up to 1,024 digits, cut rather than rounded. A repeating block is found when it starts and comes round again within the first 4,096 digits after the point; a longer one is reported as not ending.
      • Bases above 36, such as base 60, are not supported — they need more than the 36 symbols 0–9 and A–Z.
      • Negative numbers are written with a minus sign in every base; complements are shown only in the signed-forms table, for whole numbers at 8, 16, 32 and 64 bits. For IEEE 754 floating-point bit patterns, use the Programmer Calculator.

      Privacy

      Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

      Frequently asked questions

      How do I convert binary to decimal?

      Multiply each bit by its place value — 1, 2, 4, 8, … from the right — and add: 1101₂ = 8 + 4 + 0 + 1 = 13. For a fraction, the places after the point are worth ½, ¼, ⅛ and so on: 0.101₂ = ½ + ⅛ = 0.625.

      How do I convert decimal to binary?

      Divide by 2 again and again and write down the remainders: 13 → 6 r 1 → 3 r 0 → 1 r 1 → 0 r 1. Read the remainders from the last to the first: 1101. The tool shows this table for any base.

      Why does 0.1 never end in binary?

      0.1 is 1/10, and 10 = 2 × 5. A fraction ends in binary only if its denominator is a power of 2, so 0.1 becomes 0.0001100110011… forever. Computers round it, which is why 0.1 + 0.2 shows as 0.30000000000000004 in JavaScript.

      What is two’s complement?

      The usual way computers store negative whole numbers. In n bits, −x is stored as 2ⁿ − x: −42 in 8 bits is 256 − 42 = 214 = 1101 0110. A quick way by hand: write 42 in binary (0010 1010), flip every bit (1101 0101) and add 1 (1101 0110).

      What do the brackets in a result mean?

      The digits inside repeat forever: 0.1(6) is 0.16666… and 0.(3) is 0.333…. You can type them the same way, so 0.(3) in base 10 converts to exactly 0.1 in base 3.

      How do I convert hex to binary quickly?

      Each hexadecimal digit is exactly four bits: F = 1111, A = 1010, so FA = 1111 1010. Octal works the same way with three bits per digit. The tool shows this shortcut whenever both bases are powers of two.

      What is the largest base I can use?

      Base 36: the ten digits 0–9 and the 26 letters A–Z. Base 36 is often used for short codes, because it packs a large number into few characters.

      Quick answers and tool search

      Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.