Number Base Converter

Convert between binary, octal, decimal, and hexadecimal

Runs in your browserUtility06Date & Number

What is Number Base Converter?

A base converter that translates an integer between any radix from 2 to 36, showing binary, octal, decimal, and hexadecimal results at the same time and handling values well beyond 64 bits. Conversion happens entirely in the browser, with no network request.

How to use Number Base Converter

  1. 1Enter a value and pick the base it is currently written in.
  2. 2Read off the four common bases, which update as you type.
  3. 3For any other radix, use the custom base field and choose a value between 2 and 36.
  4. 4Copy any result with one click; hexadecimal output is lowercase by default.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

parseInt('ff', 16);        // 255 - always pass the radix explicitly
(255).toString(2);         // '11111111'

// Use BigInt for large integers
BigInt('0xffffffffffffffff').toString(10);

Common errors and how to fix them

SymptomCauseFix
parseInt returns the wrong number in JavaScriptThe radix argument was omitted, and strings starting with 0 fall back to implementation-defined behaviour.Always state the base, for example parseInt(str, 10).
The last few digits of a large number are wrongThe value exceeds Number.MAX_SAFE_INTEGER, so double-precision floats lose precision.Switch to BigInt for both the arithmetic and the conversion.

Frequently asked questions

Why is hexadecimal used so much in programming?+

One hex digit maps exactly onto four bits, so a single byte is always two hex characters. That makes hex far more compact than binary while preserving the bit-level correspondence, which is why colour values, memory addresses, and bitmasks are conventionally written in hexadecimal.

Does this converter handle negative numbers or fractions?+

It works on non-negative integers. Negative values are stored as two's complement, so you need to fix a bit width (8, 16, 32, or 64) before a binary string is even well defined, and fractions bring in IEEE 754 floating-point representation. Both are separate problems from plain radix conversion.

Related tools

All tools