Number Base Converter

Convert numbers between binary, octal, decimal, hex and any base from 2 to 36. BigInt-exact, with two's complement and a bit-toggle grid.

Runs entirely in your browser — nothing is uploaded

Number

Try:

Enter a number above. Bases 2 to 36 are supported, integers are held as BigInt so nothing is rounded, and fractions are converted as exact rationals rather than through a float.

Bases here are positional numeral systems using the digits 0-9 then a-z — the same alphabet as JavaScript's toString(36). That is not the same thing as the Base32 or Base64 encodings, which repack bytes into a different alphabet and pad the result; use the encoding tools for those. Input is capped at 5,000 characters, and nothing you type is uploaded, stored or logged.

About the Number Base Converter

Type a number in any base from 2 to 36 and see it in binary, octal, decimal, hexadecimal and one base of your choosing, all at once. A leading 0x, 0b, 0o or 0d sets the base on its own; underscores, spaces and apostrophes are treated as digit grouping, so 0b1011_0110 and 1'000'000 paste in as-is. Alongside the conversions you get the bit width, the popcount, whether the value fits in an 8, 16, 32, 64 or 128-bit integer signed and unsigned, its two's-complement hex in each of those widths, and a bit-toggle grid for 8/16/32/64-bit values where clicking a bit rewrites the number.

The reason this is not a one-line parseInt wrapper is that parseInt and Number.prototype.toString(base) both go through a double, and a double runs out of integers at 2^53. parseInt('9007199254740993') quietly returns 9007199254740992 — the right number of digits, the wrong number. Anything involving a 64-bit ID, a Snowflake, a Twitter/X status ID, a Postgres bigint or a hash is past that line. Every value here is a BigInt from the moment it is parsed, so a 5,000-digit number round-trips through base 3 and back with every digit intact. The other half of the parseInt trap is that it stops at the first character it does not understand and never says so: parseInt('12abc') is 12, and parseInt('0x10') is 16 even when you meant decimal. This tool refuses malformed input, names the offending character and its Unicode code point, and tells you the smallest base the digits would be valid in.

Fixed-width integers are the second place people get burned, and JavaScript is the worst offender: its bitwise operators coerce everything to a signed 32-bit integer, so 0xFFFFFFFF | 0 is −1, 1 << 31 is negative, and 1 << 32 is 1 rather than 4294967296. The fits table makes the width and signedness explicit instead of implied — 200 is a perfectly valid uint8 and the identical byte read as int8 is −56, which is the whole class of bug behind a temperature sensor that reports 200°C or a checksum that flips sign. Where a value genuinely has no two's-complement form at a given width, the cell shows a dash rather than a wrapped-around number that would look plausible and be wrong.

Fractions are handled as exact rationals rather than floats. Type 0.1 and the binary column reads 0.0(0011) — the bracketed part recurs forever, which is precisely why no binary floating-point type can hold one tenth and why 0.1 + 0.2 !== 0.3. Remainders are memoised as the expansion is generated, so a recurring expansion is detected and its period reported instead of being silently chopped off; only when nothing repeats or terminates within your chosen digit budget is the output labelled cut short. Two honest limits worth knowing: input is capped at 5,000 characters because cross-base conversion of anything larger is slow enough to lock up the tab, and the bases here are positional numeral systems over the digits 0-9a-z — the same alphabet as toString(36) — which is not the same thing as the Base32 or Base64 *encodings* that repack bytes into a different alphabet.

Everything runs inside your browser using standard web APIs. Your data is never uploaded, never stored on a server, and never leaves your device — you can confirm that by opening your browser devtools Network tab, or by switching off your Wi-Fi and using the tool offline.

Frequently asked questions

Can it handle numbers larger than 64 bits?

Yes. Values are held as BigInt, not as doubles, so there is no 2^53 or 2^64 ceiling — a 300-digit number converts to base 3 and back without losing a digit. The only limit is 5,000 input characters, which exists because converting anything longer between bases takes long enough to make the tab unresponsive; past that the tool refuses rather than hanging.

Why does the same hex value show as a different number in my code?

Almost always signedness or width. 0xFF is 255 as a uint8 and −1 as an int8; 0xFFFFFFFF is 4294967295 unsigned and −1 as a 32-bit signed int. JavaScript makes this worse because its bitwise operators coerce operands to signed 32-bit, so 0xFFFFFFFF | 0 evaluates to −1. The fits table shows both readings side by side for every width so you can see which one your language picked.

Why is 0.1 shown as recurring in binary?

Because it is. One tenth has no finite binary expansion — it is 0.0(0011) repeating, exactly the way one third has no finite decimal expansion. That is the root cause of 0.1 + 0.2 not equalling 0.3 in every language with IEEE 754 floats. The tool computes the expansion from an exact rational, spots where the remainder repeats, and brackets the period rather than pretending the digits stop.

Is base 32 or base 36 here the same as Base32 or Base64 encoding?

No, and the similar names cause real confusion. Base 32 and base 36 here are positional numeral systems that write a single number using the digits 0-9 then a-z, which is what JavaScript's toString(36) does. Base32 and Base64 are byte encodings: they slice a byte stream into 5- or 6-bit groups, map those onto a different alphabet and pad the result. Use the Base64 or text encoder tools for those.

Why does it refuse to auto-detect the base of "ff"?

Because guessing would be worse than asking. Auto-detect reads a 0x, 0b, 0o or 0d prefix and nothing else; with no prefix it reads decimal and tells you so. "ff" has no prefix and is not decimal, so instead of quietly assuming hexadecimal it stops and tells you the digits need at least base 16. The same reasoning applies to commas: "1,5" is 1.5 in much of Europe and 15 elsewhere, and getting that wrong changes the value by a thousand, so it is refused rather than guessed.

What does clicking a bit in the grid do?

It flips that bit and rewrites the number above in whichever base you are working in, so you can build a flags value or a register mask by hand. The shift buttons behave like fixed-width shifts in C, Java or Rust — a bit shifted past the top is dropped, not carried into a wider value. The grid only appears for whole numbers that actually fit the selected width; if the value is too large, or has a fractional part, the grid is hidden with an explanation instead of showing you the low bits of something else.

Does it work offline?

Yes. Once the page has loaded, everything runs locally. There is no server, no API call and no analytics on the value you enter — you can disconnect from the network and the tool keeps working.