Skip to content
DevTools

Number Base Converter

int → int

Convert between binary, octal, decimal, hex and any base up to 36.

input is

Conversion runs on big integers, so a full 64-bit value like ffffffffffffffff converts exactly rather than rounding as a JavaScript number would.

About Number Base Converter

Enter a number in binary, octal, decimal, hexadecimal, or any base up to 36, and read it back in all of the common ones at once. The 0x, 0b and 0o prefixes are accepted and so are the underscores you would write in source code, so you can paste a literal straight out of your editor.

Everything is computed with big integers rather than JavaScript numbers. That distinction is invisible until it matters and then it matters completely: a 64-bit identifier like ffffffffffffffff is larger than a double can represent exactly, so a converter built on ordinary numbers silently returns a value ending in 616 instead of 615. Here it converts exactly, however long it is.

The readout also reports how many bits the value needs and the smallest integer type it fits in, which is usually the actual question behind the conversion.

Common questions

Why does hexadecimal exist if computers use binary?
Because one hex digit is exactly four bits, so hex is a compact, exact shorthand for binary that people can read. A 32-bit value takes 32 binary digits or 8 hex digits, and no arithmetic is needed to convert between them.
What is the highest base, and why 36?
36, because that is 10 digits plus 26 letters. Beyond that there is no agreed alphabet — base64 exists but uses a different scheme with case sensitivity and padding, which is why it is a separate tool rather than base 64 here.
Can it convert negative numbers?
Yes, with a leading minus sign. Note this is a signed decimal representation, not two's complement: -1 shows as -1 in hex, not as ffffffff. Which one you want depends on whether you are reading a value or a raw register.
Why did another converter give me a different answer for a long number?
Almost certainly floating-point rounding. Anything above 2^53 cannot be held exactly in a JavaScript number, so converters that use one lose the low digits. If two tools disagree on a 16-digit hex value, the one ending in an unexpected digit is the one that rounded.

This page does the work itself, in this tab. Nothing you paste is sent to a server. Close the tab and no copy remains.