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 (2550xff0b11111111)
  • Expand Unix permission octals such as 755 into decimal and bit patterns
  • Translate small masks and protocol constants between human and machine notation

How to use

  1. Select the base of your input: decimal, hex, octal, or binary.
  2. Enter an integer. Leading +/- and common prefixes are accepted; invalid digits for the base show an error immediately.
  3. Copy one row or Copy all four representations from the toolbar.
  4. Use Sample for 255 (full byte), then Clear when finished.

Examples

Input / settingOutputNotes
255 decimaldecimal 255; hex 0xff; octal 0o377; binary 0b11111111Full 8-bit byte.
0b1010 binarydecimal 10; hex 0xa; octal 0o12; binary 0b1010Small bit-mask style value.
755 octaldecimal 493; hex 0x1ed; octal 0o755; binary 0b111101101Common Unix permission notation.
-10 decimaldecimal -10; hex -0xa; octal -0o12; binary -0b1010Signed 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-bit 0b11110110 for −10).
  • Digits must match the selected base (2 is invalid in binary). Fractions such as 1.5 are 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.