OmniTools
developerDifficulty: 3/5

Number Base Converter

Convert integers between binary, octal, decimal, hexadecimal and any base from 2 to 36, exactly, with two’s-complement views.

Valid digits for base 10: 0123456789

Details

Bit length8
SignPositive or zero
Fits a JavaScript number exactlyYes

Two’s complement

16-bit hex
00ff
32-bit hex
000000ff
64-bit hex
00000000000000ff

Widths too small to hold this value are omitted rather than shown truncated.

Integers only: Fractional values in another base involve rounding decisions that cannot be stated honestly without exact rational arithmetic, so a value with a decimal point is rejected rather than silently truncated.

How it works

  1. Enter an integer and say which base it is written in.
  2. Binary, octal, decimal and hexadecimal are shown immediately; any base from 2 to 36 is available.
  3. Two’s-complement views are shown for values that fit 8, 16, 32 or 64 bits.
Privacy & Processing: Conversion happens entirely in your browser using exact BigInt arithmetic. The value you enter is never uploaded.

Frequently Asked Questions

Is it exact for very large numbers?

Yes. Every value is handled as a BigInt, so a 64-bit or 256-bit number converts precisely. Converters built on ordinary JavaScript numbers report 0xFFFFFFFFFFFFFFFF as 18446744073709552000, which is wrong; this one returns 18446744073709551615.

What about negative numbers?

A leading minus sign is supported, and for developers the two’s-complement representation is shown at 8, 16, 32 and 64 bits — so -1 correctly appears as ff, ffff, ffffffff and ffffffffffffffff. Widths too small to hold the value are omitted rather than shown truncated.

Does it convert decimal fractions?

No, integers only. Fractional digits in another base involve rounding decisions that would need exact rational arithmetic to state honestly, so the tool rejects them rather than silently truncating.

Can I paste 0x, 0b or grouped digits?

Yes. The matching prefix for the selected base is accepted, and underscores, spaces or commas between digits are ignored. A prefix that belongs to a different base is treated as an invalid digit rather than quietly stripped.

Related Tools