Type the value, choose the base it is currently in and the base you want, and the result updates live; use Swap to reverse the direction.
Values with a leading 0x, 0b, or 0o prefix are recognized automatically for the matching base, so pasted values just work. If a character does not belong in the chosen base, the tool names exactly which character and position is wrong instead of failing silently. Copy the result to your clipboard with one click.
Number Base Converter (Binary/Hex/Octal/Decimal)
Convert a number between binary, octal, decimal, and hexadecimal (or any custom base 2-36), right in the browser.
Key features
- Converts a typed value between binary (base 2), octal (base 8), decimal (base 10), hexadecimal (base 16), or a custom base 2 to 36, live on every keystroke.
- From-base and To-base each offer the four common presets plus a "Custom base..." option from 2 to 36.
- Accepts and strips common prefixes - 0x for hex, 0b for binary, 0o for octal - so pasted values just work.
- The Swap button exchanges the From and To bases and reuses the last result as the new input, so you can convert the other direction in one click.
- The Copy-result button copies the current output to the clipboard.
- An invalid digit for the chosen base produces a plain-language error that names the offending character and its position, shown inline in the output area rather than only in the console.
- On page load a worked example (ff in hex becomes 255 in decimal) is already shown, so you see a result with zero interaction.
Common bases at a glance
| Base | Name |
|---|---|
| 2 | Binary |
| 8 | Octal |
| 10 | Decimal |
| 16 | Hexadecimal |
Custom bases from 2 to 36 are supported for less common conversions beyond these four presets.
How it stays accurate
Conversion uses exact digit-by-digit BigInt arithmetic, not the native Number type, so values beyond 2^53 - 1 stay accurate instead of silently losing precision. Negative numbers are handled only with JavaScript's own signed-integer semantics for a leading minus sign, not two's-complement representation for an arbitrary bit width.
Privacy
Everything runs in this browser tab; the value you type is never uploaded to a server or stored beyond the page session, and no account or signup is required.
Frequently Asked Questions
What does Number Base Converter (Binary/Hex/Octal/Decimal) do?
Convert a number between binary, octal, decimal, and hexadecimal (or any custom base 2-36), right in the browser.
When should I reach for number base converter (binary/hex/octal/decimal)?
Custom bases from 2 to 36 are supported for less common conversions beyond the four common presets.
Does it handle negative numbers?
Only in JavaScript's signed-integer sense (a leading minus sign) - it does not represent negative numbers in two's-complement form for an arbitrary bit width.