Base Converter

Convert integers between bases 2–36.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Type a number, then pick the base it is in and the base you want. 255 in decimal is ff in hexadecimal, and binary 101101 is 45.

How to use

1
Step 1
Type the value (letters allowed for bases above 10).
2
Step 2
Set the base you are converting from.
3
Step 3
Set the base you want.
4
Step 4
Press Calculate.

How it works

Each digit is worth a power of the base. Binary 101101 = 32 + 8 + 4 + 1 = 45. Digits above 9 use letters, so A = 10 and F = 15, and base 36 uses all letters up to Z. Upper and lower case are both accepted, and a 0x, 0b or 0o prefix is allowed. Digits after a point are worth negative powers: binary 0.1 is 1 × 2⁻¹ = 0.5.

value = Σ dᵢ × baseⁱ

Worked example

Hex to binary

Input
3F from base 16 to base 2
Output
111111
Walkthrough
3F = 3 × 16 + 15 = 63, and 63 = 32 + 16 + 8 + 4 + 2 + 1, which is six 1s in binary.

Limitations

  • Bases must be between 2 and 36.
  • Fractions are converted to about 20 digits after the point, so 0.1 in decimal becomes 0.00011001100110011001 in binary, which is a close value rather than an exact one.
  • A digit that is not valid in the base is an error: 1021 in base 2 returns Invalid digit "2" for base 2.
  • Only one point is allowed; 1.2.3 is rejected.

Questions

What is 255 in hexadecimal?
ff.
What is 101101 binary in decimal?
45.
What is -13 in binary?
-1101. The sign is kept.
What is 777 octal in decimal?
511.
What is 123456 in base 36?
2n9c.
What is 10.5 in binary?
1010.1, because the.5 is 1 × 2⁻¹.
Can I type 0xff or 0b1010?
Yes. The 0x, 0b and 0o prefixes are accepted, so 0xff from base 16 is 255.
What happens with a wrong digit, such as 129 in base 8?
The tool shows an error (Invalid digit "9" for base 8) instead of guessing.

Features

  • Bases 2 to 36
  • Negative numbers and fractions
  • Flags invalid digits
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Vectors | Essence of linear algebra

    3Blue1Brown

    Linear algebra intuition for matrix and vector tools.

    Watch on YouTube
  • Variables, expressions, and equations

    Khan Academy

    Expression language for scientific and expression calculators.

    Watch on YouTube
  • Percentages

    Math is Fun

    Percent of / percent change patterns for everyday calculators.

  • Order of Operations

    Math is Fun

    PEMDAS/BODMAS when expression calculators surprise you.