Binary to Decimal, Decimal to Binary and Hex Converter - with IEEE 754 and Two's Complement
This converter turns a number into every base you are likely to meet in code, hardware documentation or a computer science class: binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). It also shows the three ways computers store negative integers - signed magnitude, one's complement and two's complement - and the 32-bit IEEE 754 floating-point layout. Type a value, tell the tool what you typed, and every other representation appears at once.
Everything runs inside your browser. Nothing you type is uploaded anywhere, and the page keeps working offline.
How to Use the Binary to Decimal Converter
- Enter the number in the input box - you can paste it from a disassembler, a datasheet or a spreadsheet.
- Check the detected format. The tool reads the pattern of your input and highlights every base it could belong to.
- Pick the right one with the chips above the results. Clicking a chip changes the interpretation, not the digits.
- Read the table. Each row is the same value written in a different representation.
- Copy what you need. Binary and hexadecimal output keeps the leading zeros that the format requires.
Because detection works on patterns, some inputs are ambiguous. 1010 is 10 if you meant binary and 1010 if you meant decimal, and both are valid, so the tool offers both and lets you choose. That is a feature, not a tie - it is how you tell a binary string from a decimal one at a glance.
How to Convert Binary to Decimal
The place-value method
Write each bit above its place value, then add up the values of the bits that are 1. Place values start at 1 on the right and double at every step: 1, 2, 4, 8, 16, 32, 64, 128, and so on.
| Bit | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Keep the 128, 32, 16, 4 and 1 columns: 128 + 32 + 16 + 4 + 1 = 181. So 10110101 in binary is 181 in decimal.
A faster route for long strings
Split the string into groups of four bits, starting from the right: 1011 0101. Each group of four is exactly one hexadecimal digit, so those groups are B and 5, and the value is 0xB5 = 181. Reading nibbles as hex first and converting hexadecimal to decimal afterwards is far less error prone than adding sixteen place values by hand.
Binary fractions
Bits to the right of the point halve their weight instead of doubling: 1010.11 is 8 + 2 + 0.5 + 0.25 = 10.75. This is exactly the position that IEEE 754 floating point stores below.
How to Convert Decimal to Binary
Divide by 2 again and again and write down each remainder, then read the remainders from the bottom up. Converting 156:
| Division | Quotient | Remainder |
|---|---|---|
| 156 / 2 | 78 | 0 |
| 78 / 2 | 39 | 0 |
| 39 / 2 | 19 | 1 |
| 19 / 2 | 9 | 1 |
| 9 / 2 | 4 | 1 |
| 4 / 2 | 2 | 0 |
| 2 / 2 | 1 | 0 |
| 1 / 2 | 0 | 1 |
Read upwards: 10011100. Check it the other way: 128 + 16 + 8 + 4 = 156. To convert decimal to hex instead, divide by 16 - 156 / 16 = 9 remainder 12, so the answer is 0x9C.
Binary to Decimal Table
Sixteen values cover every possible nibble, which is why this short table does most of the work when you read a hex dump or step through a bitmask.
| Binary | Decimal | Octal | Hex |
|---|---|---|---|
| 0000 | 0 | 0 | 0 |
| 0001 | 1 | 1 | 1 |
| 0010 | 2 | 2 | 2 |
| 0011 | 3 | 3 | 3 |
| 0100 | 4 | 4 | 4 |
| 0101 | 5 | 5 | 5 |
| 0110 | 6 | 6 | 6 |
| 0111 | 7 | 7 | 7 |
| 1000 | 8 | 10 | 8 |
| 1001 | 9 | 11 | 9 |
| 1010 | 10 | 12 | A |
| 1011 | 11 | 13 | B |
| 1100 | 12 | 14 | C |
| 1101 | 13 | 15 | D |
| 1110 | 14 | 16 | E |
| 1111 | 15 | 17 | F |
The pattern is regular: appending a bit on the right doubles the value, and a nibble that ends in 1 is always odd in decimal.
Hex to Decimal and Binary to Hex
Why hexadecimal exists
Four bits fit into one hex digit, so a 32-bit word is exactly eight characters. That is why memory addresses, colours such as #FF8800, machine code, UUIDs and hashes are all written in base 16 - and why the step between binary and hex is a grouping operation rather than arithmetic.
Hexadecimal to decimal by hand
Multiply each digit by 16 raised to its position, counting from 0 on the right: 2A3 is 2 x 256 + 10 x 16 + 3 = 512 + 160 + 3 = 675. Remember that A to F stand for 10 to 15.
Binary to hex and back
Group from the right in fours and pad the leftmost group with leading zeros: 10110101 becomes 1011 0101 becomes 0xB5. Going back, expand each hex digit into four bits: 0x7E becomes 0111 1110. This is the single most useful trick in this whole article - every other conversion can be done as a chain of these two steps.
Octal, in Brief
Octal groups bits in threes instead of fours, and it survives mainly in Unix file permissions such as chmod 755. Converting 156: 156 / 8 = 19 remainder 4, 19 / 8 = 2 remainder 3, 2 / 8 = 0 remainder 2, so the answer is 234. In binary the same value regroups as 010 011 100.
Two's Complement, One's Complement and Signed Magnitude
A bit string has no sign of its own, so hardware needs a convention for negative numbers. There are three, and the difference between them is a classic source of bugs when you read a disassembly, a binary protocol or a textbook problem. Here is -5 stored in an 8-bit word:
| Representation | Bits | How it is built |
|---|---|---|
| Two's complement | 11111011 | Invert all bits, then add 1 |
| One's complement | 11111010 | Invert all bits |
| Signed magnitude | 10000101 | Sign bit plus the plain value |
| Excess-127 | 10000100 | Value plus 127, stored unsigned |
Two's complement
Take 5 as 00000101, invert it to 11111010, then add 1 to get 11111011. It has exactly one zero, and it lets subtraction run on the same adder as addition, which is why every modern processor uses it. In 8 bits it covers -128 to 127; in 32 bits, -2,147,483,648 to 2,147,483,647.
One's complement
Just invert the bits. Simple to describe, but it wastes a code point on a second zero (00000000 and 11111111 both mean zero) and needs an end-around carry, which is why it died out.
Signed magnitude
The top bit is the sign and the remaining bits are the magnitude, so -5 is 10000101. It is the easiest to read by eye and the most awkward to compute with - it also has two zeros - which is why it survives mostly in textbooks and in floating-point sign bits.
Excess-127, or biased notation
Add 127 to the value and store the result as an unsigned number: 5 becomes 132, which is 10000100. Biased storage makes the ordinary unsigned comparison order match the numeric order, which is exactly what the exponent field of IEEE 754 needs.
IEEE 754 Single Precision (32-bit)
An ordinary float in C, Java, JavaScript, Python and Go is a 32-bit or 64-bit IEEE 754 number. The 32-bit form, binary32, is laid out like this:
| Field | Width | Meaning |
|---|---|---|
| Sign | 1 bit | 0 for positive, 1 for negative |
| Exponent | 8 bits | Stored with a bias of 127 |
| Fraction | 23 bits | Mantissa with an implicit leading 1 |
Worked example: why 0.1 is not 0.1
0.1 in binary is 0.0001100110011... with the 0011 repeating forever, so a 32-bit float can only store the nearest approximation. Normalised, the value is 1.100110011... x 2^-4. The exponent field is -4 + 127 = 123, which is 01111011. The fraction is the repeating part cut to 23 bits and rounded up: 10011001100110011001101.
0 01111011 10011001100110011001101 groups into 0011 1101 1100 1100 1100 1100 1100 1101, which is 0x3DCCCCCD. This is the number behind the famous 0.1 + 0.2 result: the computer is not being careless, it is storing the closest value it can.
The sign bit, and a second example
-1.5 normalises to 1.1 x 2^0, giving sign 1, exponent 127 (01111111) and a fraction of 1 followed by zeros: 0xBFC00000. Flip only the top bit and you get 0x3FC00000, which is +1.5. That single bit is the entire difference between a positive and a negative float.
When you actually need this
Decoding a sensor reading, matching the hex a C program wrote to a file, comparing a Rust backend with a JavaScript frontend, or reading the bit pattern of float32 in a protocol dump - in all of these the bytes are right in front of you and the meaning is not. Paste the hex, pick IEEE 754, and the table reverses the encoding for you.
Frequently Asked Questions
Is this converter free?
Yes. There is no account, no usage limit and no watermark. The whole conversion runs in the page.
Is my data uploaded anywhere?
No. The conversion is performed by JavaScript in your browser, so the numbers you type never reach a server. That also means the tool works offline, and it is safe for internal addresses and values you cannot paste into an online form.
What is the difference between hex and hexadecimal?
Nothing - hex is just the short form of hexadecimal, both meaning base 16. "Hex to decimal" and "hexadecimal to decimal" are the same conversion.
Can it convert negative numbers?
Yes, in all three signed conventions: two's complement, one's complement and signed magnitude. If your input looks like a bit pattern the tool will offer every signed reading of it, which is the quickest way to see why 11111011 is -5 in two's complement but -123 in one's and -123 in signed magnitude.
Does it handle fractions and floating point?
Yes. Fractional binary input such as 1010.11 is converted like any other value, and the IEEE 754 row shows the single-precision encoding of the number you entered.
Which base does it assume if I type 1010?
It does not assume. 1010 is valid binary, octal, decimal and hexadecimal, so all four are offered and the digits stay as you typed them until you choose. Pick the chip that matches your source.
Why does 0.1 show up as 0x3DCCCCCD?
Because 0.1 has no exact binary representation - the fractional part repeats - so the stored 32-bit value is the nearest one available. The same reason explains 0.1 + 0.2, and the same reason makes comparisons of floats with == unreliable.
How large a number can it handle?
Conversions are done with ordinary JavaScript numbers, so the tool is built for everyday values and for studying formats, not for arbitrary-precision arithmetic on thousand-digit integers.