What Is a Decimal to Binary Converter?
A decimal to binary converter translates a number written in the everyday base-10 system (using digits 0–9) into the base-2 system (using only 0 and 1) that computers use internally. Binary is the native language of digital electronics: every value stored in memory, every pixel, and every instruction is ultimately a sequence of bits. This tool performs the conversion for any non-negative whole number and shows you both the resulting binary string and how many bits it occupies.
How to Use It
Enter a non-negative integer in the Decimal Number field and submit. The calculator returns the binary equivalent, the original decimal value, and the bit length. Negative numbers and decimal fractions are not supported; only whole numbers of zero or greater are converted.
The Formula Explained
The standard method is repeated division by 2. Divide the number by 2 and write down the remainder (0 or 1). Replace the number with the integer quotient and repeat until the quotient reaches 0. The binary result is all the remainders read in reverse order — from the last division to the first.
$$\text{Binary} = \left(\text{Decimal}\right)_{10} \longrightarrow \sum_{i=0}^{k} b_i \cdot 2^{i}\ \text{where}\ b_i = \left\lfloor \frac{\text{Decimal}}{2^{i}} \right\rfloor \bmod 2$$
For example, the most significant bit comes from the final division, and the least significant bit from the first division. Reading top-to-bottom gives the wrong order, so always read the remainders bottom-to-top.
Worked Example
Convert 156 to binary:
\(156 \div 2 = 78\ \text{r}\ \mathbf{0}\)
\(78 \div 2 = 39\ \text{r}\ \mathbf{0}\)
\(39 \div 2 = 19\ \text{r}\ \mathbf{1}\)
\(19 \div 2 = 9\ \text{r}\ \mathbf{1}\)
\(9 \div 2 = 4\ \text{r}\ \mathbf{1}\)
\(4 \div 2 = 2\ \text{r}\ \mathbf{0}\)
\(2 \div 2 = 1\ \text{r}\ \mathbf{0}\)
\(1 \div 2 = 0\ \text{r}\ \mathbf{1}\)
Reading the remainders from bottom to top gives 10011100, an 8-bit number. Verify: \(128 + 16 + 8 + 4 = 156\). ✔
Interpreting the Bit Count
The bit count is the number of binary digits needed to write the number with no leading zeros. For a positive integer \(n\):
$$\text{bits}(n) = \lfloor \log_2 n \rfloor + 1$$
The number 0 is a special case because \(\log_2 0\) is undefined. It is written as a single digit, 0, so it uses 1 bit.
The largest value that fits in \(n\) bits is \(2^n - 1\), where every bit is 1. For example, 4 bits give \(2^4 - 1 = 15\).
Example: for 200, \(\log_2 200 \approx 7.64\), so \(\lfloor 7.64 \rfloor + 1 = 8\) bits. Check: \(200 = 128 + 64 + 8\), so the binary form is 11001000, which has 8 digits.
| Size | Common name | Max unsigned value (\(2^n - 1\)) | Signed range (two's complement) |
|---|---|---|---|
| 4-bit | Nibble | 15 | −8 to 7 |
| 8-bit | Byte | 255 | −128 to 127 |
| 16-bit | Word (on many systems) | 65,535 | −32,768 to 32,767 |
| 32-bit | Double word | 4,294,967,295 | −2,147,483,648 to 2,147,483,647 |
| 64-bit | Quad word | 18,446,744,073,709,551,615 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Signed vs. unsigned: an unsigned integer uses all \(n\) bits for magnitude, so its range is 0 to \(2^n - 1\). A signed integer in two's complement, the most common scheme, reserves the top bit for sign. Its range is \(-2^{n-1}\) to \(2^{n-1} - 1\). Signed 8-bit values therefore run from −128 to 127, and 200 does not fit in signed 8-bit even though it fits in unsigned 8-bit.
This converter handles non-negative whole numbers. If the bit count is larger than your target type, the value will overflow, so choose a wider type.
Binary Terminology Glossary
- Bit
- A binary digit, which is either 0 or 1. It is the smallest unit of digital information.
- Byte
- A group of 8 bits. A byte can represent 256 different values (0 to 255 unsigned).
- Nibble
- A group of 4 bits, or half a byte. It maps to exactly one hexadecimal digit (0 to 15).
- Base (radix)
- The number of distinct digits in a positional number system. Decimal is base 10 and binary is base 2.
- Most significant bit (MSB)
- The leftmost bit, which carries the largest place value. In an n-bit number it is worth \(2^{n-1}\).
- Least significant bit (LSB)
- The rightmost bit, worth \(2^0 = 1\). It determines whether the number is odd (1) or even (0).
- Remainder
- What is left after a division. In repeated division by 2, each remainder (0 or 1) is one binary digit. Reading the remainders from last to first gives the binary number.
- Positional notation
- A way of writing numbers in which a digit's value depends on its position. In binary, each position is a power of 2: \(1101_2 = 1\cdot 2^3 + 1\cdot 2^2 + 0\cdot 2^1 + 1\cdot 2^0 = 13\).
- Unsigned integer
- A whole number with no sign, so it is zero or positive. An n-bit unsigned integer ranges from 0 to \(2^n - 1\).
- Leading zeros
- Zeros on the left of a number that do not change its value, such as 00001101 and 1101. They are often added to pad a value to a fixed width such as 8 or 32 bits, but they are not counted in the minimal bit length.
FAQ
Why does binary only use 0 and 1? Because base 2 has exactly two symbols, mirroring the two stable states (off/on, low/high voltage) of digital circuits.
What does the bit count mean? It is the number of binary digits needed to represent the value — useful for understanding storage size and data types.
Can it convert 0? Yes. Zero in binary is simply 0, represented with a single bit.