Developer tool

Number Base Converter

Convert between binary, octal, decimal, hex and any base from 2 to 36 with exact BigInt maths, and explore AND, OR, XOR, NOT and shifts in a bit view.

Free, no sign-up. Runs in your browser; nothing is uploaded.

Convert

  • Binary (2)
    1111 1111
  • Octal (8)
    377
  • Decimal (10)
    255
  • Hex (16)
    ff
  • Custom (36)
    73

Uses arbitrary-precision integers, so very large values stay exact. Digits above 9 are letters a to z. Prefixes like 0x and 0b are accepted for the matching base.

Bitwise view

Width
Value (8 bits set, two's complement for negatives)
00000000000000000000000011111111
Operation
00000000000000000000000000001111

Result: 15 (decimal) | 0xf | 0b1111

How to use the number base converter

Binary, octal, decimal, hex and everything between

Programmers move between number bases all the time: hex for colours and memory addresses, binary for flags and masks, octal for Unix file permissions, base 36 for short IDs. This converter handles them all with exact arithmetic.

Converting

Choose the base your number is written in, type it, and see it in binary, octal, decimal and hex together with one extra base of your choice from 2 to 36. Digits above 9 are the letters a to z. Turn on digit grouping to split binary and hex into groups of four and decimal into thousands. Every row has a copy button that copies the plain ungrouped value.

Changing the input base converts the number you typed so you do not lose your place.

Bigger than 64 bits

Everything uses BigInt, so there is no 53-bit precision cliff like you meet in ordinary JavaScript numbers. That makes it safe for hashes, IDs, cryptographic values and other large integers.

The bitwise view

Pick a width: 8, 16, 32 or 64 bits. The value is drawn as a grid of bits in groups of four, with set bits highlighted and a count of how many are on. Negative numbers appear in two's complement.

Below that you can apply an operation with a second value written in the same base:

  1. AND keeps bits set in both values, useful for masking.
  2. OR sets bits set in either, useful for turning on flags.
  3. XOR flips bits where the values differ, used in toggling and simple checksums.
  4. NOT inverts every bit within the width.
  5. Left and right shift move bits, multiplying or dividing by powers of two.

The result is shown as bits, decimal, hex and binary.

Handy reminders

  • Hex digit = 4 bits, so two hex digits are one byte.
  • Octal digit = 3 bits, so 755 is 111 101 101.
  • Base 36 uses 0-9 and a-z and is often used for compact IDs.

Frequently asked questions

How large can the numbers be?

As large as you like. The tool uses arbitrary-precision BigInt integers, so a 200-digit hex value converts exactly with no rounding.

Does it support fractions or floating point?

No, whole numbers only. Fractional bases and floating-point formats follow different rules and are better inspected with dedicated tools.

How are negative numbers shown in the bit view?

As two's complement at the chosen width. For example -1 in 8-bit is 11111111. The width menu lets you check a value at 8, 16, 32 or 64 bits.

What happens when the value is too wide?

The bit view tells you the value does not fit and asks you to choose a wider size. The plain conversions still work.

Which prefixes are accepted?

0x for hex, 0b for binary and 0o for octal, when they match the selected input base. Underscores, commas and spaces inside the number are ignored.

Why do shifts and NOT depend on width?

Because the result is limited to that many bits: NOT of 0 is all ones within the width, and left shifts drop bits that fall off the end.