Number Base
Binary, octal, decimal, hex.
How it works
Convert whole numbers; 0x, 0b and 0o prefixes are recognised. Fractions and invalid digits are rejected.
Worked example with the defaults
This example is calculated from the page defaults. Change the form to update the live result.
| Value | 255 |
|---|---|
| Input base | Decimal |
| Calculated result | 255 · Base 10 |
| Binary | 11111111 |
| Octal | 377 |
| Decimal | 255 |
Integer input rules
Enter an integer in base 2, 8, 10 or 16 to see the other representations.
Limits and assumptions
- Fractions and partially valid strings are rejected instead of silently truncated.
- Arbitrary-precision integers are supported, not fractions; 0x, 0b and 0o prefixes override the selected base.
- A leading sign is allowed; separators such as commas and spaces inside digits are not.
Common questions
Why are decimal fractions rejected?
This tool converts integers; fractions need separate precision and rounding rules.
Do I still select hex when entering 0x?
No. A recognized prefix selects the base automatically.