How to use
- Choose the input base: binary, octal, decimal or hexadecimal.
- Enter a whole number such as 255, 0xff or -0b1010.
- Select Convert, or press Enter in the input box.
- Read the value in all four bases and copy the one you need.
Prefixes and signs
You can write a number with its usual prefix: 0b for binary, 0o for octal and 0x for hexadecimal, in upper or lower case. A prefix must match the input base you selected, so 0x1f is rejected when Binary is selected instead of being guessed.
A leading + or - sign is allowed and goes before the prefix, for example -0xff. Negative results are shown with a leading minus sign, not as two's complement. Spaces around the number are ignored; spaces, underscores or other separators inside it are rejected.
Exact results for long numbers
Conversions use JavaScript BigInt, so values far beyond 2^53, such as 2^64, 2^128 or a 64-digit hex string, convert exactly with no rounding. Inputs of up to 4,096 digits are supported.
Hexadecimal output uses lowercase letters without a prefix. Zero is shown as 0 in every base.
What is rejected
Only whole numbers are supported. Fractions, decimal points and exponents such as 1.5 or 1e3 are rejected, as are digits that do not belong to the selected base, such as 2 in binary or 9 in octal. The error names the base and the position of the first invalid character.
FAQ
- Why does 0b1 convert in hexadecimal mode?
- In hexadecimal, b is an ordinary digit, so 0b1 is the hex number 0B1 (177 in decimal). Select Binary to read it as a binary number.
- Is my data sent anywhere?
- No. Conversions run in your browser. Nothing you enter is sent to a server, stored, or added to the page URL.
- Can I convert negative numbers or fractions?
- Negative whole numbers are supported and keep their minus sign in every base. Fractions and floating-point values are not supported.