# Number Base Converter

> Convert between binary, octal, decimal, hex and base 36 with arbitrary precision, and read the bits as a signed 8, 16, 32 or 64-bit integer. In your browser.

Source: https://www.revquix.com/tools/number-base-converter
Cost: free, no signup

---

Every base at once, plus what the bits actually mean - including the signed reading, which is why the same byte is 255 in one place and minus one in another. Arbitrary precision, so a 64-bit id converts exactly.

## At a glance

- Takes: A number in any base, with or without a 0x, 0b or 0o prefix
- Returns: Binary, octal, decimal, hex and base 36, plus the bit breakdown
- Handles: Arbitrary precision, and two’s complement at 8, 16, 32 and 64 bits
- Privacy: Runs in your browser - nothing you paste is uploaded

## Every value is arbitrary precision, and that is the point

The standard parsing functions lose precision above two to the fifty-third, and the values people bring to a base converter are routinely above it: a 64-bit snowflake id, a nanosecond timestamp, a permissions bitmask, a hash prefix. A tool that silently rounds a sixteen-digit integer gives you a confidently wrong answer, which is worse than refusing to answer.

Everything here uses arbitrary-precision integers, so a 64-bit value converts exactly in every base. Underscores, spaces and commas in the input are ignored, so a grouped literal copied out of source code pastes straight in.

## The signed reading is the reason to use this

A base table is one library call. What is worth showing is that the same byte is 255 unsigned and minus one signed, and that which of those your program sees depends on a type declaration nowhere near the literal.

So the bit pattern is rendered as a two’s-complement signed integer at every width it fits in, and the widths where that reading differs from the unsigned value are marked - because those are exactly the cases where the top bit is set and somebody is about to be surprised.

- Binary grouped into nibbles, so bit positions can be read off the page
- Which bit positions are set, for a flag set or a permissions mask
- The value as big-endian bytes, matching what a hex dump shows
- A warning above the safe-integer limit, where the platform’s own number type stops being exact

## Base detection

With detection on, a hex, binary or octal prefix selects the base and anything else is read as decimal - which is what a developer pasting a value out of a log or a source file expects, and it means the common case needs no configuration at all. An explicit base still tolerates a matching prefix, so pasting a prefixed hex value with hex already selected is not an error.

## What it will not do

It handles integers only. Floating-point values have their own representation - sign, exponent and mantissa - and showing a float’s bit pattern is a different tool with a different explanation, so a decimal point is rejected rather than truncated.

It does not perform bitwise arithmetic between two values, and it does not know what your bits mean. A permissions mask, a feature-flag set and a colour value are all the same number here; naming the bits is your context, not the converter’s.

## Questions people ask

### Why does a hex value show as negative at 32 bits?

Because the top bit is set, and at a fixed width that is what two’s complement means. The same pattern is a large positive number when read unsigned and a negative one when read signed, and which your program sees comes from the declared type rather than from the literal. Both readings are shown side by side for exactly this reason.

### Can it convert a 64-bit id exactly?

Yes. Every conversion here uses arbitrary-precision integers, so a nineteen-digit id converts without rounding. That is not true of most converters, and it is not true of anything built on the platform’s ordinary number type, which stops being exact above two to the fifty-third minus one.

### What is base 36 for?

Compact identifiers. Base 36 uses the digits plus the twenty-six letters, so it encodes a number in roughly the fewest characters that stay alphanumeric - which is why short-link services and some id schemes use it. It is included because converting to it by hand is tedious and nothing else about it is interesting.

### Does it handle floating-point numbers?

No, and that is deliberate. A float’s bits are a sign, an exponent and a mantissa, and rendering them as if they were a plain integer would be actively misleading. Integer conversion and float-layout inspection are different explanations, so a decimal point is rejected rather than silently truncated.

### Why are the bits grouped in fours?

Because each group of four bits is exactly one hexadecimal digit, so you can read the hex value straight off the binary and back again. It is also the grouping that makes a bit position countable at a glance, which is what you need when the value is a permissions mask.
