Base Converter
Convert integers between bases 2–36.
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
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?
What is 101101 binary in decimal?
What is -13 in binary?
What is 777 octal in decimal?
What is 123456 in base 36?
What is 10.5 in binary?
Can I type 0xff or 0b1010?
What happens with a wrong digit, such as 129 in base 8?
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 YouTubeVariables, 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.