Number Base Converter

Convert integers of any size between binary, octal, decimal, hexadecimal and any base from 2 to 36 — with negative numbers and a two's complement view for 8, 16, 32 and 64 bits.

Digits for base 10: 0–9. A leading - is allowed. Spaces and underscores are ignored.

Examples:

Conversions

8 bits of magnitude
  • Binary (2)1111 1111
  • Octal (8)377
  • Decimal (10)255
  • Hexadecimal (16)FF
  • Base 36 (36)73

Two's complement (fixed width)

How the number is stored in an 8/16/32/64-bit integer, and how that bit pattern reads as signed and unsigned.

  • 8-bithex 0xFFsigned -1unsigned 255
    1111 1111
  • 16-bithex 0x00FFsigned 255unsigned 255
    0000 0000 1111 1111
  • 32-bithex 0x0000_00FFsigned 255unsigned 255
    0000 0000 0000 0000 0000 0000 1111 1111
  • 64-bithex 0x0000_0000_0000_00FFsigned 255unsigned 255
    0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 1111

What this converter is for

Programmers constantly move between number systems: a register dump is in hexadecimal, a permission mask is in octal, a bit flag makes more sense in binary, and the value you want to reason about is in decimal. This tool takes one integer in any base from 2 to 36 and shows it in binary, octal, decimal, hexadecimal and one extra base of your choice at the same time.

It also answers the question that a plain base converter ignores: what does this number look like inside a fixed-size integer? The two's complement panel shows the 8, 16, 32 and 64-bit pattern and reads it back as both signed and unsigned, which is exactly what you need when debugging overflow, parsing binary protocols or reading a value from a hex editor.

How to use it

  1. Choose the Input base (Decimal by default). Any base from 2 to 36 is available.
  2. Type the value in the Number field. You can add a leading minus sign, the matching prefix (0b, 0o or 0x) and underscores or spaces as separators.
  3. Read the Conversions panel. The row for your input base is highlighted; each row has a Copy button that copies the value without grouping separators.
  4. Optionally pick an Extra output base (for example base 36 for short IDs) and toggle Show 0b / 0o / 0x prefixes or Group digits.
  5. Check the Two's complement panel to see the fixed-width representation.

Worked example

Select Hexadecimal (16) and enter 0xFF. The converter shows:

Binary (2)        1111 1111
Octal (8)         377
Decimal (10)      255
Hexadecimal (16)  FF

8-bit   hex 0xFF    signed -1    unsigned 255
16-bit  hex 0x00FF  signed 255   unsigned 255

Now enter -1 in decimal. The 32-bit row shows 0xFFFF_FFFF with unsigned value 4294967295: the same 32 bits that a C int holding -1 contains, and the value you get if you cast it to uint32_t.

What the results mean

  • Conversions are exact mathematical conversions of the signed value. A negative number simply keeps its minus sign in every base; no bit width is assumed.
  • Bits of magnitude is the number of binary digits needed for the absolute value — useful to check whether something fits in a given type.
  • Two's complement rows show the value reduced to N bits. A value fits if it is a valid signed (−2N−1 to 2N−1−1) or unsigned (0 to 2N−1) N-bit integer; otherwise the row says it is out of range instead of silently truncating.
  • Signed / unsigned are the two readings of the same bit pattern. If they differ, the highest bit is set.

Limitations

The converter works with integers only: fractional values such as 0.1 or floating-point bit layouts (IEEE 754) are not supported. Input is limited to 10,000 digits to keep the page responsive. Two's complement is shown for the common widths 8, 16, 32 and 64 bits; other widths (such as 128-bit) are not listed, although the plain conversions handle numbers of any size.

Tips and common mistakes

  • Pick the base before pasting. 10 means ten in decimal, sixteen in hex and two in binary. If you see an "invalid digit" error, the input base is probably wrong.
  • Leading zeros don't matter for the value, but they do for bit patterns — the two's complement rows pad to the full width for that reason.
  • Octal file modes: 755 in base 8 is 111 101 101 in binary — read, write, execute for the owner and read, execute for group and others.
  • Hex colors are three bytes: convert each pair separately, or use the color converter to get RGB and HSL directly.
  • Working with encoded data rather than numbers? Try the Base64 encoder/decoder.

Frequently Asked Questions

How large a number can this converter handle?

Any size up to 10,000 input digits. The arithmetic uses JavaScript BigInt, so a 64-bit value like 18446744073709551615 or a 200-digit number converts exactly, without the rounding you get from regular floating-point numbers.

Does it support negative numbers?

Yes. Type a leading minus sign in any base (for example -FF in hexadecimal) and every output keeps the sign. The two's complement panel also shows how that negative value is stored as an 8, 16, 32 or 64-bit integer.

Why does 0xFF show -1 as signed and 255 as unsigned?

In an 8-bit integer the bit pattern 11111111 means 255 when read as unsigned and -1 when read as signed two's complement. The converter shows both interpretations so you can see what a C, Java or Rust variable of that width would contain.

Can I convert to bases other than 2, 8, 10 and 16?

Yes. Both the input base and the extra output base can be any integer from 2 to 36. Digits above 9 use the letters A to Z, which is the same convention as JavaScript's Number.prototype.toString(radix) and Python's int(text, base).

Is the 0x prefix required for hexadecimal input?

No. The prefix is optional and only the prefix that matches the selected input base is removed (0b for binary, 0o for octal, 0x for hexadecimal). That is why 0B10 in hexadecimal correctly reads as 2832 instead of being mistaken for a binary prefix.

Is my input sent to a server?

No. Every conversion runs locally in your browser with JavaScript. Nothing you type is uploaded, stored or logged.