Number Base Converter
Convert between binary, octal, decimal, hexadecimal.
Your number is converted in your browser.
Integers only. Optional +/− sign and matching 0b, 0o or 0x prefix. Up to 4096 digits.
Conversions
Convert signed integers between binary, octal, decimal and hexadecimal, with exact results for large numbers.
How to use it
- Enter an integer and select its current base: 2, 8, 10 or 16.
- Read all four exact results as you type. Correct any invalid digits indicated by the error message.
- Copy the result you need, or clear the input to start again.
How number bases work
A base tells you how many digit symbols a number system uses. The same integer has different representations in different bases: decimal 42 is binary 101010, octal 52 and hexadecimal 2A.
| From Base | Allowed digits | 42₁₀ |
|---|---|---|
| Binary · 2 | 0–1 | 101010 |
| Octal · 8 | 0–7 | 52 |
| Decimal · 10 | 0–9 | 42 |
| Hexadecimal · 16 | 0–9, A–F | 2A |
Place value: from binary to decimal
Each position is worth a power of the base, starting at power zero on the right. Multiply each digit by its position value and add the terms. In hexadecimal, A to F stand for decimal 10 to 15; one hexadecimal digit represents four binary digits.
101010₂ = 1×2⁵ + 1×2³ + 1×2¹ = 32 + 8 + 2 = 42₁₀ = 2A₁₆
Input rules and exact results
Select the base the input is written in; it is not detected automatically. Matching prefixes are optional: 0b for binary, 0o for octal and 0x for hexadecimal, after any sign. Hexadecimal accepts either letter case. The selected base takes precedence: 0B10 in base 16 means hexadecimal B10, not binary 10. Surrounding whitespace is ignored; internal spaces, commas, decimal points and scientific notation are rejected. Leading zeros do not change the chosen base.
BigInt arithmetic preserves integers exactly, including values beyond 9007199254740991, up to 4096 input digits excluding sign and prefix. Results have no prefix or leading zeros; hexadecimal uses uppercase letters. Negative numbers keep a minus sign: −42 becomes −101010, not a fixed-width two’s-complement bit pattern. Fractions, custom bases and bit-width settings are not supported.
Frequently asked questions
Which number bases can I convert?
Binary (2), octal (8), decimal (10) and hexadecimal (16). Select the input base; all four results appear together. Custom bases are not supported.
Can I convert negative numbers or fractions?
Negative integers are supported with a leading minus sign. For example, decimal -42 becomes binary -101010. This is not a fixed-width two’s-complement representation. Fractions and scientific notation are not supported.
Are large numbers rounded?
No. The converter uses BigInt for exact integer arithmetic, including values above 9007199254740991. Input is limited to 4096 digits, excluding an optional sign and matching prefix. Over-limit or invalid input produces an error, not a partial result.