Binary to Decimal & Hex Converter

Convert binary to decimal, hex, octal or any base 2–36. Exact for huge integers, repeating fractions and two's complement; points to the first bad digit.

  • Runs in your browser
  • Your data never leaves your browser
  • Free · No Sign-Up
Group integer digits with underscores or spaces: three digits in decimal, four in other bases. Prefixes apply to binary, octal and hex; letter case affects bases above 10. Copy includes the full displayed text, with its grouping and prefix, even when the row scrolls.
Choose 8, 16, 32, 64 or 128 bits to add binary and hex two’s complement results. Integers only; an N-bit result accepts values from -2^(N-1) through 2^N-1. The bit pattern is padded to the selected width.
Select a bit width first. An integer input is then read as a signed pattern of that width: a set top bit makes it negative. A negative input must fit the signed range; a positive pattern must fit the selected number of bits.
Choose a base from 2 to 36. Results update as you type. A matching 0b, 0o or 0x prefix is accepted; Decimal also detects the base from these prefixes.
Up to 20,000 digits in total. Integers keep their precision. Fraction output stops at 64 digits: parentheses mark a repeating block, and an ellipsis marks truncation without rounding. The status line identifies input errors and their character positions.
Decimal
Binary
Hex
Octal
The fifth result starts at base 36. Choose any base from 2 to 36; this row updates immediately, alongside the four fixed Decimal, Binary, Hex and Octal rows.
Show the working
 
Open the working below the results. Non-decimal input can show positional expansion; repeated division appears when its target differs from 10 and the input base. Steps cover the integer part only. Expansion allows 64 significant input digits; division allows 64 decimal digits.
Read the full guide How to Convert Binary to Decimal: Place Values, Doubling and Back Again
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Example: a 64-bit ID That JavaScript Cannot Hold

Discord IDs are 64-bit “snowflakes”, and the Discord API reference says they are sent as strings “to prevent integer overflows in some languages”. The documentation’s sample ID is 175928847299117063. With Decimal selected and Two’s complement set to 64-bit:

  • Hex: 271065AC1020007
  • 64-bit binary: 0000001001110001000001100101101011000001000000100000000000000111

The first 42 bits hold the time. Paste them back with Binary selected:

The result is 41944705796 milliseconds after the Discord epoch, the same number as in the documentation’s diagram. The ID itself is larger than Number.MAX_SAFE_INTEGER (2^53 − 1, MDN), so parseInt('175928847299117063') returns 175928847299117060. This tool parses every digit with BigInt and keeps all 18.

Example: Negative Numbers and Two’s Complement

Different tools write −10 in binary in different ways. JavaScript’s (-10).toString(2) gives -1010: a minus sign in front of the magnitude. Java’s Integer.toBinaryString(-10) gives the 32-bit pattern, because Java stores an int in two’s complement. This tool shows both:

  • Binary row: -1010
  • 8-bit row: 11110110 (hex F6), with the note “unsigned 246, signed −10”
  • 32-bit hex row: FFFFFFF6

To read a pattern from a register dump or a hex editor, type it, pick the width and tick Read input as signed. FFFFFFF6 with 32 bits reads as −10. A value outside the width, such as −129 for 8 bits, is reported with the range −128 to 255 (the signed and unsigned ranges together).

Example: Fractions That Never End

0.1 in decimal becomes 0.0(0011) in binary and 0.1(9) in hex. The digits in parentheses repeat forever. That is why a JavaScript Number, which is an IEEE 754 double (MDN), cannot hold 0.1 exactly and 0.1 + 0.2 is not 0.3. Fractions whose denominator divides a power of the new base do end: 0.625 is 0.101 in binary and 0.A in hex.

The tool does the arithmetic on exact fractions, so it never rounds. If the repeating block is longer than 64 digits, it shows the first 64 digits and an ellipsis.

What You Can Paste

InputRead as
1111_0000, 1111 0000, 1111'0000Separators between digits are ignored (Python, Java and C++14 styles)
1,234,567Thousands commas in base 10 only
0x1F, 0o17, 0b101The prefix is dropped when it matches the input base. With Decimal selected, the prefix picks the base
#FF5733A CSS color in base 16
255, FF, −42Full-width characters and the Unicode minus sign are read as ASCII
-0xffA sign before the prefix

Anything else stops the conversion and names the character and its position, for example "2" at position 5 is not a base-2 digit (allowed: 0–1) for 10102. JavaScript’s parseInt('10102', 2) returns 10 instead: it stops at the first bad digit without an error.

How This Differs From RapidTables

RapidTables is the first Bing result for “binary to decimal”. We gave both tools the same inputs on 2026-10-01. RapidTables handles large integers correctly (9007199254740993 → hex 20000000000001). These cases differ:

  • Decimal 0.1 → RapidTables gives 0.0001100110011001101 and 0.1999999999999999999A, cut and rounded without a mark. This tool gives 0.0(0011) and 0.1(9).
  • Decimal -10 → RapidTables picks a 16-bit two’s complement on its own. Here you choose the width.
  • 1111_0000, 255 and 1,000 → RapidTables shows “Illegal input!” without saying which character. This tool converts them.

Limits

  • Bases 2 to 36 with the digits 0–9 and A–Z, the same range as Python’s int() and JavaScript’s toString(). Base 58, base 62 and Base64 alphabets are not supported.
  • Up to 20,000 digits. Python’s int() stops at 4,300 decimal digits by default (Python docs), so a very long result from here may need sys.set_int_max_str_digits() there.
  • The parentheses in 0.0(0011) are notation for reading. No input box, including this one, accepts them back.
  • The tool converts exact numbers. It does not show the IEEE 754 bit layout of a float (sign, exponent, mantissa).
  • Two’s complement needs an integer and one of the five widths. Excel-style 10-bit or 40-bit patterns appear as the low bits of the 16-bit or 64-bit row.

For text instead of numbers, use the Text to Binary Translator or the ASCII Converter. Octal file modes have their own Chmod Calculator, and subnet masks in binary are in the IP Subnet Calculator.

FAQ

How do I convert binary to decimal by hand?

Multiply each bit by its place value and add the results. The place values from the right are 1, 2, 4, 8, 16 and so on, so 11010110 is 128 + 64 + 16 + 4 + 2 = 214. Open "Show the working" under the tool to see this sum for your own number, and the repeated division that goes back the other way.

Why does 0.1 become 0.0(0011) in binary?

0.1 is 1/10, and 10 has the factor 5, which 2 does not divide. A fraction ends in base 2 only if its denominator is a power of 2, so 1/10 repeats forever. The tool finds the repeating block and puts it in parentheses: 0.0(0011) means 0.0001100110011 and so on.

How do I get the two's complement of a negative number?

Type the negative number, for example -10, and pick a width under Two's complement. The tool shows the pattern for that width: 11110110 (F6) for 8 bits, FFFFFFF6 for 32 bits. To go the other way, type the pattern, pick the width and tick Read input as signed: F6 in 8 bits reads as -10.

Is there a size limit?

Up to 20,000 digits per number. Integers of any size inside that limit are exact because the tool uses JavaScript BigInt. Fractions that do not end or repeat within 64 digits are cut there and marked with an ellipsis.

Why does another converter give a different answer for a large number?

Many converters store the value as a JavaScript Number, which holds integers exactly only up to 2^53 - 1 (9,007,199,254,740,991). Above that the last digits change. Enter 9007199254740993 here and the hex result is 20000000000001; a Number-based tool gives 20000000000000.