Number Utilities
Number Base Converter
Convert signed integers among binary, octal, decimal, and hexadecimal without losing precision. Spot invalid digits before reusing a value.
✓ Every tool runs in your browser. We do not upload your input or output.
Keyboard shortcuts
Ctrl/⌘ + Enter: process
Ctrl/⌘ + Shift + F: full screen
Esc: exit full screen
Ctrl/⌘ + F in editor: search
How to use
- Enter one whole number, with an optional sign or matching 0b, 0o, or 0x prefix.
- Select the source base and the destination base.
- Check the converted digits and correct any highlighted invalid source digit.
- Copy or download the result for code, documentation, or a calculation.
Examples
Turn a byte mask into binary
Select hexadecimal as the source and binary as the destination. Leading zeroes are not preserved.
0x2f
101111
Keep a large integer exact
Decimal to hexadecimal uses big integers, so this value above JavaScript's safe-number limit remains exact.
9007199254740993
20000000000001
Move between common integer representations
Binary makes bit masks visible, hexadecimal makes byte-oriented values compact, and decimal is easiest for everyday reading. Enter an integer, choose its current base, and select the base you need. The converter accepts the conventional 0b, 0o, and 0x prefixes when they match the selected source base. A leading plus or minus sign is allowed as well. Its output contains the converted digits and a minus sign when needed; it does not add a prefix.
This is useful when checking a permission mask, comparing a debugger value with a specification, or copying a constant into source code. For example, hexadecimal 0x2f becomes binary 101111. If a fixed eight-bit field is needed, add leading zeroes yourself. The conversion represents the numeric value, so leading zeroes in the input do not carry over.
Preserve exact large integers
The converter uses BigInt, which keeps large whole numbers exact instead of rounding them through floating-point arithmetic. That matters for identifiers and masks larger than 9007199254740991, the largest safe integer in JavaScript’s Number type. It does not accept fractions or exponent notation: these are integer-base conversions, not general numeric formatting.
When a character is not valid for the selected source base, the tool reports its location. For instance, 2 cannot appear in binary input, and G cannot appear in hexadecimal input. Check the source base before changing the digits. Processing happens in a Web Worker in your browser; the entered value is not uploaded. The shared workspace can display long values with internal scrolling and lets you copy the complete output.
Frequently asked questions
Which bases are available?
Binary (2), octal (8), decimal (10), and hexadecimal (16). Select each base explicitly in the controls.
Can I enter a negative number?
Yes. A leading minus sign is accepted and preserved in the converted result.
Do prefixes have to match the source base?
Yes. Use 0b with binary, 0o with octal, or 0x with hexadecimal. Decimal input has no prefix.
Are very large numbers rounded?
No. The converter uses JavaScript BigInt for exact integer arithmetic. It does not accept fractional values.
Why did my leading zeroes disappear?
The output is a numeric representation rather than a fixed-width bit string. Add padding separately when a protocol requires a width.