Skip to main content

Binary Hex Decimal Converter

Convert between binary, octal, decimal, and hex with BigInt precision.

Written by Golam Rabbani, Founder & Lead Engineer

Optional prefixes 0b, 0o, 0x are accepted

How to use this binary hex decimal converter

  1. Pick the input base (binary, octal, decimal, or hex).
  2. Type or paste the value into the "Value to convert" field. Optional prefixes 0b, 0o, and 0x are accepted and stripped automatically.
  3. Press Convert to render the value in all four bases at once.
  4. Use each row's Copy button to copy that representation, or Copy all to grab them as a single block.
  5. Press Reset to clear everything.

About this binary hex decimal converter

The converter parses your input using a BigInt-based digit-by-digit accumulator, so accuracy is preserved for arbitrarily large numbers — well beyond the 2^53 safe integer limit of JavaScript's `number` type. The result is then rendered in binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Negative numbers are written with a leading minus sign in every base; this is signed-magnitude form, which is the convention used for programmer-facing displays.

A concrete example: enter `255` with input base "Decimal".

- Binary: `11111111` - Octal: `377` - Decimal: `255` - Hex: `FF`

Switch the input base to "Hexadecimal" and type `0xDEADBEEF`. The prefix is stripped, and the tool reports decimal `3735928559`, binary `11011110101011011011111011101111`, and octal `33653337357`. This is useful for embedded firmware work, decoding HTTP color codes, reading file format specifications, or sanity-checking bitmask values during code review. Everything runs locally in your browser.

FAQ

Why does the tool use BigInt instead of regular numbers?
JavaScript's `number` type only represents integers exactly up to 2^53 − 1 (≈ 9 quadrillion). BigInt has no upper bound, so the converter remains accurate for very large values such as 256-bit hashes or memory addresses.
Can I paste a value with the 0x, 0b, or 0o prefix?
Yes. The tool detects and strips `0x` (hex), `0b` (binary), and `0o` (octal) prefixes before parsing, as long as the prefix matches the selected input base.
How are negative numbers handled?
Negative inputs are written with a leading minus sign in every base — for example `-255` decimal becomes `-FF` hex. The tool does not produce two's-complement bit patterns because their width depends on the target system (8-bit, 16-bit, 32-bit, ...).
Is hex case-sensitive?
Input accepts both uppercase and lowercase hex digits (`ff` and `FF` are equivalent). The output always uses uppercase letters for hex for visual clarity.
What if I type an invalid character?
The tool validates input against the digit set for the selected base (`0–1` for binary, `0–7` for octal, `0–9` for decimal, `0–9` and `a–f` for hex). Any other character produces an inline error message instead of a garbage result.
Is my data uploaded?
No. All conversion runs locally in your browser using built-in BigInt — no values are sent to any server.