Decimal to Binary Converter
Convert numbers to binary with an interactive bit-switch interface. Supports 8, 16, and 32-bit padding and signed integers.
About
Binary representation is the fundamental language of computing hardware. While simple text converters exist, understanding the relationship between bit positions and their decimal values is critical for networking (subnet masks), embedded systems, and low-level programming. This tool provides a dual-interface approach: enter a decimal number to see its binary form, or toggle individual bits to observe how they construct the decimal value.
Bit-level manipulation often results in errors regarding padding and signed values. This utility allows forced bit-depth (8, 16, or 32-bit) to align with standard memory registers and visually indicates the sign bit for negative integers, mimicking how a CPU ALU (Arithmetic Logic Unit) processes data.
Formulas
To convert a decimal integer N to binary, we perform repeated division by 2.
This process continues until the quotient q is zero. The binary string is the sequence of remainders (bit) read from last to first.
For signed numbers (Two's Complement), if x is negative:
This inverts all bits of the absolute value and adds 1.
Reference Data
| Bit Position | Power of 2 | Decimal Value | Example (Byte) |
|---|---|---|---|
| 0 | 20 | 1 | 0000 0001 |
| 1 | 21 | 2 | 0000 0010 |
| 2 | 22 | 4 | 0000 0100 |
| 3 | 23 | 8 | 0000 1000 |
| 4 | 24 | 16 | 0001 0000 |
| 5 | 25 | 32 | 0010 0000 |
| 6 | 26 | 64 | 0100 0000 |
| 7 | 27 | 128 | 1000 0000 |