ToolPick

Number base converter

Convert integers between binary, octal, decimal, hex and any base from 2 to 36.

How it works

Digits are read one at a time in the input base (0–9 then a–z, case-insensitive) and accumulated into an integer, then written out with the other bases. Only integers from −(2^53 − 1) to 2^53 − 1 (9,007,199,254,740,991) are accepted, because larger values cannot be represented exactly by JavaScript numbers; the tool refuses them rather than rounding. A leading minus sign is allowed, the matching 0b, 0o or 0x prefix is accepted, and spaces or underscores can group digits. Negative numbers are shown with a minus sign, not as two's complement. Fractions are not supported.

Runs in your browser; nothing is uploaded.

FAQ

What is 255 in binary and hex?

255 is 11111111 in binary, 377 in octal and ff in hexadecimal: eight 1-bits, or the largest value of one unsigned byte.

Why is there a limit of 2^53 − 1?

Beyond 9,007,199,254,740,991 consecutive integers can no longer all be represented as JavaScript numbers, so the converted digits could silently be wrong. Larger values, such as 64-bit integers, are rejected with a message instead.

How are negative numbers shown?

With a minus sign in front, as -ff for −255. Fixed-width two's complement forms like 0xFFFFFF01 depend on a chosen bit width and are not produced here.

Related developer tools

Bookmark this page for next time, or copy its link. Shared links contain no working input.