RunTheTests
/

Number Base Converter

Convert a number between binary, octal, decimal and hex — exactly, at any size.

What you provide

Result

255 = 255 (decimal)

The same value in each base. A prefix on the input (0x, 0b, 0o) sets the base automatically; otherwise the selected base is used. Large values are exact — no precision is lost.

Diagnostic telemetry
Binary
0b11111111
Octal
0o377
Decimal
255
Hexadecimal
0xFF

What this cannot tell you

  • Whole numbers only. Fractional and negative values are not converted.
  • A 0x, 0b or 0o prefix sets the base automatically and overrides the selector.

Take this with you

How this calculation works

Enter a number and the tool shows it in all four bases at once. If you prefix it — 0x for hex, 0b for binary, 0o for octal — the base is detected automatically. Conversions use arbitrary-precision integers, so even 64-bit values stay exact.

What the results mean

Hexadecimal
Base 16, using 0–9 and A–F. Compact for bytes — one hex digit is four bits, two make a byte.
Binary
Base 2. What the machine actually uses; long but unambiguous.

Frequently asked questions

Will large numbers lose precision?

No. The converter uses arbitrary-precision integers, so a full 64-bit value like a bitmask or a large ID converts exactly. A naive JavaScript converter loses precision past about 9 quadrillion (2^53); this one does not.

Can I convert negative numbers or decimals?

Not currently — this handles non-negative whole numbers. Negative values in binary depend on a chosen width and two’s-complement convention, which is a separate concern.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/number-base-converter/" width="100%" height="560" style="border:1px solid #e5e5e5;border-radius:8px" title="Number Base Converter" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/number-base-converter/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in DevTools