Skip to content
Burrows Tools

Number Base Converter

Type a number in any base from 2 to 36 and read it back in binary, octal, decimal, hexadecimal, and one base of your choosing, all at once. The arithmetic is done with BigInt, so nothing is rounded on the way through: 2^64 + 1 comes back as 0x10000000000000001 rather than as the nearest value a JavaScript number can hold, and a 4,096-bit value converts exactly. The 0x, 0b, and 0o prefixes are understood on the way in and optional on the way out, spaces and underscores between digits are ignored, and long numerals are grouped for reading — four digits at a time in binary and hexadecimal, three in decimal and octal. Negative numbers keep their minus sign, because a two's-complement pattern means nothing until you say how wide the integer is; when that is what you want, the panel below shows the pattern at 8, 16, 32, and 64 bits and tells you when the value does not fit. A digit the base does not have is named, with its position, instead of being quietly ignored. Everything runs in this tab.

Base 10 uses 0-9. Spaces, underscores and commas between digits are ignored.

Display options

Binary · base 2

0b1111 1111

Octal · base 8

0o377

Decimal · base 10

255

Hexadecimal · base 16

0xff
73

8 bits · 1 byte

Two’s complement

The bit pattern a signed integer of a fixed width would hold. Above, negatives keep their minus sign, because a pattern means nothing until you say how wide the box is.

32-bit hexadecimal · base 16

0x0000 00ff

32-bit binary · base 2

0b0000 0000 0000 0000 0000 0000 1111 1111

How to use the number base converter

  1. Type or paste the number, then pick the base it is written in — every base from 2 to 36 is in the list.
  2. Read it back in binary, octal, decimal, and hexadecimal at once, and set the last row to any other base you need.
  3. Turn the 0x/0b/0o prefixes, digit grouping, and uppercase A-F on or off to match the code you are pasting into.
  4. Copy a row with its button: the clipboard gets the digits without the grouping spaces, which are there for reading rather than for compiling.
  5. For a fixed-width bit pattern, pick 8, 16, 32, or 64 bits under Two's complement.

Frequently asked questions

How do I convert binary to decimal here?
Set “Read it as” to base 2, then type or paste the binary digits — the decimal row updates as you type, along with octal, hexadecimal, and whichever base you have chosen for the last row. It works the same way in reverse: to go from decimal to binary, leave the input base at 10 and read the binary row. You can paste 0b1010 with its prefix, or 1010 1010 with the grouping spaces still in it.
Does it stay exact past 64 bits?
Yes. Every value is a BigInt, so there is no point at which the number becomes a floating-point approximation of itself. This is not a theoretical worry: parseInt and Number lose the low bits above 2^53, which is why 9007199254740993 comes back from Number as 9007199254740992. Here, 2^64 + 1 converts to hexadecimal, back to decimal, and through all 35 bases with every bit intact, and a 4,096-bit number is fine too. Input is capped at 10,000 characters so a paste cannot freeze the tab.
How are negative numbers handled?
With a sign: -5 in binary is -101. That is the exact answer, and it is the only one that can be given without more information, because -5 is 11111011 in an 8-bit integer and 1111111111111011 in a 16-bit one — the pattern is a property of the width, not of the number. The two's-complement panel at the bottom is where the width goes: pick 8, 16, 32, or 64 bits and it shows the pattern in hexadecimal and binary, zero-padded to that width, or says plainly that the value does not fit.
Can I paste 0x, 0b, and 0o prefixes?
Yes, as long as the prefix agrees with the base you are reading in; a prefix that contradicts it is refused by name rather than guessed at. There is one deliberate exception: in base 16, 0b1 is a legal hexadecimal numeral worth 177, and in base 36 every prefix letter is a digit, so in those bases the digits win over the prefix reading. On the way out, the prefixes are a toggle — on for pasting into code, off for pasting into a document.
Is my number sent anywhere?
No. The parsing, the conversion, and the two's-complement panel are all JavaScript running in this tab, and the page keeps working with the network off once it has loaded. Nothing is uploaded, nothing is stored, and no request is made while you type.