Number base

Convert an integer between binary, octal, decimal, and hex.

Added 2026-10-31

What it does

An integer is shown in binary, octal, decimal, and hexadecimal in this tab. The source base is 2, 8, 10, or 16. Underscores and a matching prefix such as 0x are optional. Without a width, the integer is kept exactly, including a value past 2^53 - 1, and a minus sign stays a minus sign. With a width of 8, 16, 32, or 64 bits, a value that does not fit as an unsigned integer is rejected and is not wrapped. Binary and hexadecimal are padded to that width. The signed reading is two's complement: for eight bits, ff is 255 unsigned and -1 signed. A leading minus with a width set is rejected, because the sign is not a bit pattern. The text is not uploaded.

How to use it

  1. Enter an integer and choose the source base.
  2. Leave the width unset to keep every digit, including a minus sign.
  3. Set 8, 16, 32, or 64 bits to see padding and the signed reading. A value that does not fit stops.

Common mistakes

  • A width does not wrap. 256 does not fit in 8 unsigned bits. It is rejected instead of becoming 0.
  • A minus sign is not a bit pattern. Without a width, -1 stays negative. With a width, a leading minus stops.

The conversion stays in this tab. The text is not uploaded.

Related tools