Number Base Converter
Binary, Hex & More
Convert integers between binary, octal, decimal, and hex with live 0b/0o/0x prefixes. Integer-only; stays within JavaScript safe integers.
This conversion runs only in your browser — nothing is uploaded.
- OptionsDecimal
Decimal
Hex (0x)
Octal (0o)
Binary (0b)
What is this tool?
This number base converter translates integers between base 10, 16, 8, and 2. Decimal is for human quantities; hexadecimal for bytes and memory; octal for Unix-style permissions; binary for flags and bit masks.
Choose the input base, type or paste a value (optional 0x / 0o / 0b prefixes are accepted), and read all four representations live. Outputs keep language-style prefixes so you can paste them into code comments or quick checks.
It is not a floating-point converter, IEEE 754 inspector, or arbitrary-precision BigInt calculator.
Common use cases
- Check an 8-bit byte or color channel (
255↔0xff↔0b11111111) - Expand Unix permission octals such as
755into decimal and bit patterns - Translate small masks and protocol constants between human and machine notation
How to use
- Select the base of your input: decimal, hex, octal, or binary.
- Enter an integer. Leading
+/-and common prefixes are accepted; invalid digits for the base show an error immediately. - Copy one row or Copy all four representations from the toolbar.
- Use Sample for
255(full byte), then Clear when finished.
Examples
| Input / setting | Output | Notes |
|---|---|---|
255 decimal | decimal 255; hex 0xff; octal 0o377; binary 0b11111111 | Full 8-bit byte. |
0b1010 binary | decimal 10; hex 0xa; octal 0o12; binary 0b1010 | Small bit-mask style value. |
755 octal | decimal 493; hex 0x1ed; octal 0o755; binary 0b111101101 | Common Unix permission notation. |
-10 decimal | decimal -10; hex -0xa; octal -0o12; binary -0b1010 | Signed magnitude with prefixed outputs (not two’s complement). |
Practical pitfalls
- Safe-integer ceiling: Values outside
Number.MAX_SAFE_INTEGER(±9007199254740991) are rejected. Pasting a 64-bit or BigInt literal here can look “almost right” in other tools that silently lose low bits—this page fails closed instead. - Sign ≠ two’s complement width: A leading
-prints signed prefixed forms (-0xff). It does not expand to a fixed-width two’s-complement bit string (for example 8-bit0b11110110for −10). - Digits must match the selected base (
2is invalid in binary). Fractions such as1.5are out of scope.
References
Last reviewed: 2026-07-27
Frequently asked questions
- Which bases are supported?
- Binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Outputs use familiar `0b`, `0o`, and `0x` prefixes.
- Can I paste 0x, 0o, or 0b prefixes?
- Yes. Those prefixes are stripped before parsing. Still select the matching input base so digit validation matches the alphabet you expect.
- Why does a large integer fail?
- This tool uses JavaScript Number safe integers only (about ±9×10¹⁵ / Number.MAX_SAFE_INTEGER). Bigger values need BigInt tooling or a language runtime—precision would otherwise silently corrupt.
- Does conversion run locally?
- Yes. Parsing and conversion happen in your browser; nothing is uploaded.