Binary to Decimal Converter All Number Bases
Convert between binary, decimal, octal, and hexadecimal in real time. Includes two’s complement signed mode, a positional value breakdown, and preset examples for common bit patterns.
How this binary to decimal converter reads bits the way a processor does
Every number you type into a computer eventually becomes a string of electrical states, on or off, high or low. Binary is just the written form of that reality: base 2, using only the digits 0 and 1. This tool converts between binary, decimal, octal and hexadecimal live as you type, and it also shows you the positional math behind the conversion instead of hiding it behind a black box.
Everything happens in your browser with plain JavaScript arithmetic. No value you type is sent anywhere, logged, or stored. Refresh the page and it is gone.
The positional math, digit by digit
Decimal works in powers of ten: the digit 3 in 300 means 3 times 10 squared. Binary works the same way but with powers of two. Each bit position is worth double the one to its right, so reading a binary string is really just summing up the positions where a 1 appears.
toString(8) and toString(16) to produce octal and hex, rather than converting binary directly to those bases.
This is exactly the breakdown the tool renders on screen under Positional Value Breakdown, one cell per bit showing the digit, its power of two, and its decimal contribution, so you can see the sum happening rather than just trust the answer.
Negative numbers get special handling. Rather than silently expanding a negative value into a 32-bit two’s complement string, the converter keeps the sign separate and shows the magnitude with a minus sign in front, so the positional breakdown always lines up with what you actually typed.
| Binary | Positional sum | Decimal |
|---|---|---|
| 1011 | 8 + 0 + 2 + 1 | 11 |
| 11111111 | 128+64+32+16+8+4+2+1 | 255 |
| 100000 | 32 + 0 + 0 + 0 + 0 + 0 | 32 |
| 10101 | 16 + 0 + 4 + 0 + 1 | 21 |
Why computers use base 2 at all
Transistors are reliable at distinguishing two states, current flowing or not, but far less reliable at distinguishing ten different voltage levels the way a base 10 system would require. Binary gives digital circuits a wide error margin between 0 and 1, which is why every modern processor, from a calculator chip to a data center server, ultimately operates in base 2 no matter what language or number system the programmer works in on top of it.
Live four-way sync
Typing in any of the four fields, binary, decimal, octal, hex, immediately recalculates the other three. There is no submit button because there is nothing to submit anywhere.
Grouped output
Binary results are grouped into clusters of four digits, the same nibble grouping used in datasheets and debuggers, which makes long bit strings far easier to read at a glance.
Where this comes up in real debugging
File permission bits in Unix, IP subnet masks, and hardware register flags are all binary under the hood even though tools usually display them in octal or hex for brevity. Converting between the forms by hand is slow and error prone, which is the whole reason a fast bidirectional converter earns a permanent spot in a developer’s bookmarks.
- Two’s complement is the standard method processors use to represent negative integers in binary.
- Positional notation explains the general place-value system that both decimal and binary share.
- Bash arithmetic expansion lets you check binary conversions from a terminal with base prefixes like
0xand0b.
Where base conversion matters
Setting Unix file permissions from an octal value, decoding a subnet mask into its binary form to check host ranges, reading raw register values off a microcontroller datasheet, verifying a bitmask used for feature flags in application code, and teaching students the place value system before they meet hexadecimal in a computer science course. Any task where you need to move between how a number looks and how a machine actually stores it lands here.
Frequently Asked Questions
Binary is a base-2 numeral system using only two digits: 0 and 1. Each digit position represents a power of 2, starting from 2^0 at the rightmost position and doubling leftward: 1, 2, 4, 8, 16, 32, 64, 128. To read a binary number, multiply each bit by its positional value and sum the results. For example, 1011 = 1×8 + 0x4 + 1×2 + 1×1 = 11 in decimal. Computers use binary because digital circuits naturally represent two states reliably and efficiently.
Write the binary number right to left. Assign each bit a positional value starting from 1 (powers of 2). Multiply each bit digit by its positional value, then sum all non zero products. Example: 110101 = 1×32 + 1×16 + 0x8 + 1×4 + 0x2 + 1×1 = 32 + 16 + 4 + 1 = 53. To convert decimal to binary, repeatedly divide by 2 and collect remainders from bottom to top: 53 divides to give bits 1,1,0,1,0,1, reading upward as 110101.
Octal (base 8) is used in Unix file permission notation (chmod 755). Each octal digit maps to exactly three binary bits. Hexadecimal (base 16) uses digits 0 to 9 plus A to F and is the standard notation for memory addresses, RGB colours, hash outputs, and machine code. Each hex digit maps to exactly four binary bits. Decimal does not have this clean binary mapping, which is why programmers prefer hex for compact binary representation.
Two’s complement is the standard method for signed integers in binary. For an n bit system, negative numbers are represented by inverting all bits of the positive value and adding 1. For 8 bit: -1 = 11111111, -128 = 10000000, 0 = 00000000, 127 = 01111111. The most significant bit is the sign bit. Two’s complement is preferred because addition and subtraction work identically for positive and negative numbers using the same hardware, and there is only one representation of zero.
Binary counting follows the same carry pattern as decimal but carries at 1 instead of 9. Sequence: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010. Each time all bits are 1, adding one produces a new leading 1 with all others reset to 0. An n bit number can represent 2^n distinct values (0 to 2^n minus 1 unsigned, or minus 2^(n-1) to 2^(n-1) minus 1 signed).
A bit is a single binary digit (0 or 1). A byte is 8 bits, representing 256 values (0 to 255 unsigned). A word is a processor native unit: 32 bits on a 32 bit CPU, 64 bits on a 64 bit CPU. File sizes use bytes (kilobyte = 1,024 bytes), while network speeds use bits per second. An 8 Mbps connection transfers 1 MB per second because 8 megabits equals 1 megabyte.
Group binary digits into nibbles (groups of 4) from right to left, padding with leading zeros if needed. Convert each nibble to its hex digit: 0000=0 through 1111=F. Example: 10110111 splits into 1011 and 0111, which are B and 7, giving B7. This works because 16 = 2^4, so each hex digit represents exactly 4 binary bits. Octal similarly maps 3 bits per digit since 8 = 2^3.
A 10 bit address can reference 2^10 = 1,024 locations, close to but not exactly 1,000. This is why kilobyte traditionally meant 1,024 bytes. The IEC introduced gibibyte (GiB = 2^30) to disambiguate, but most consumer software still uses GB loosely. Hard drives market in decimal gigabytes (10^9 bytes) while operating systems measure in binary gibibytes (2^30 bytes), creating the common discrepancy where a 500 GB drive shows as roughly 465 GB.
From the blog
Number theory, lightly
Base systems, primes and the statistics people get wrong.