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
- Tool input is not uploaded to ZeroTool servers
- Free · No Sign-Up
Scan with WeChat to share this tool
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". The Discord API reference says they are "always returned as strings in the HTTP API to prevent integer overflows in some languages", and its table puts a 42-bit timestamp in bits 63–22 as milliseconds since the Discord epoch. Take 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, which is 2016-04-30. 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(hexF6), 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
| Input | Read as |
|---|---|
1111_0000, 1111 0000, 1111'0000 | Separators between digits are ignored (Python, Java and C++14 styles) |
1,234,567 | Thousands commas in base 10 only |
0x1F, 0o17, 0b101 | The prefix is dropped when it matches the input base. With Decimal selected, the prefix picks the base |
#FF5733 | A CSS color in base 16 |
255, FF, −42 | Full-width characters and the Unicode minus sign are read as ASCII |
-0xff | A sign before the prefix |
With Decimal selected, -0xff is read as hexadecimal because of its prefix, and the decimal row shows -255.
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 gives0.0001100110011001101and0.1999999999999999999A, cut and rounded without a mark. This tool gives0.0(0011)and0.1(9). - Decimal
-10→ RapidTables picks a 16-bit two's complement on its own. Here you choose the width. 1111_0000,255and1,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'stoString(). 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 needsys.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's 10-bit or 40-bit patterns for a negative value are the low bits of the same value's 16-bit or 64-bit row; pasting a short pattern with a wider width reads it as a positive number.
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; the repeated division appears when the target base differs from 10 and from the input base.
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 in lowest terms 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.
Is the number I type sent or saved?
Conversion runs in your browser tab without uploading the number for processing. The tool saves only your settings (input base, extra base, grouping, prefix, lowercase, two’s complement width, signed reading and working base) in this browser’s localStorage; it does not save the number. Ctrl/⌘+L clears the current input and keeps these settings; clearing this site’s browser data removes them. The page loads Google Analytics and AdSense. Usage events contain the tool name and action only: convert after a committed input or conversion-setting change succeeds with a changed result, and copy after a successful clipboard write. Typing, initial rendering and restored settings do not emit convert; the events do not contain the number.