CalcHub

Number Base Converter — Decimal, Hex, Binary & Octal

Convert between decimal, hexadecimal, binary and octal instantly — accepts 0x, 0b, 0o prefixes, handles huge numbers exactly (BigInt, no float overflow).

Decimal
255
Hex
0xff
Binary
0b11111111
Octal
0o377

Last reviewed 2026-10-19. Rates change — verify against the official sources linked below before relying on these figures.

What this is based on

  • BigInt arithmetic — 128-bit+ integers convert exactly, no floating-point precision loss.
  • Hex without a prefix is auto-detected when it contains a–f; pure-digit strings are decimal.
  • Everything runs locally in your browser — pasted content is never uploaded, logged or stored.

The conversion you'll do most

Hex↔decimal is the daily one: colors (#ff = 255), memory addresses, error codes (0x80070005), and RGB values all speak hex. The mental shortcut: each hex digit is 4 bits, so a hex byte is exactly two digits — ff is always 255, 80 is always 128.

Binary matters when you read flags and bitmasks — 'the 5th bit is set' means a number with 0b10000 in it. Octal survives mostly in Unix file permissions: 0755 means rwxr-xr-x, each digit a 3-bit permission triplet.

Why floats fail at big conversions

JavaScript's Number loses integer precision above 2⁵³ (~9×10¹⁵) — a 64-bit ID like 0x1FFFFFFFFFFFFF silently rounds. This converter uses BigInt, so arbitrarily large values convert exactly. It's also why you should store big IDs as strings, not numbers.

Frequently asked questions

How do I convert hex to decimal?
Paste the hex (0xff or ff) above — or mentally: each hex digit × 16ⁿ. ff = 15×16 + 15 = 255.
What is 255 in binary?
0b11111111 — all 8 bits set. That's why 255 is the byte ceiling (2⁸−1).
What does 0o755 mean?
Octal 755 — the Unix rwxr-xr-x permission set: owner rwx (7), group r-x (5), others r-x (5).
Can it handle huge numbers?
Yes — BigInt arithmetic, no precision limit. Even 100-digit values convert exactly.

Related calculators