Number Base Converter
Convert between binary, octal, decimal, and hexadecimal
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
- 1Enter a value and pick the base it is currently written in.
- 2Read off the four common bases, which update as you type.
- 3For any other radix, use the custom base field and choose a value between 2 and 36.
- 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
| Symptom | Cause | Fix |
|---|---|---|
| parseInt returns the wrong number in JavaScript | The 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 wrong | The 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 toolsUnix Timestamp Converter
Convert Unix timestamps to dates and back, seconds or milliseconds
Timezone Converter
Compare a time across several zones, daylight saving handled for you
Date Difference Calculator
Calculate the gap between dates, including business days
Cron Expression Parser
Parse cron expressions and preview the next run times
Byte Size Converter
Convert storage units, keeping base 1024 and base 1000 apart
Unit Converter
Convert length, weight, area, volume, and speed