Convert any decimal (base 10) number to binary (base 2) instantly. Shows the full step-by-step division method, 8-bit output, hex, and octal conversions.
✓Verified: April 2026
Enter a whole number from 0 to 999,999,999.
Enter any non-negative integer
Binary (Base 2)
—
Was this calculator helpful?
✓ Thanks for your feedback!
Sources & Methodology
✓Binary (base 2) number system is a foundational concept in computer science and digital electronics, defined by IEEE and ANSI standards.
IEEE 754 and related standards governing binary representation in computing systems
Method: Repeated division by 2 (collect remainders, read in reverse). 8-bit output: Padded with leading zeros to 8 bits (standard byte representation). Hex: Groups of 4 bits converted to hex digits (0-F). Octal: Groups of 3 bits converted to octal digits (0-7).
JavaScript integer precision: exact for values up to 2^53 − 1 (Number.MAX_SAFE_INTEGER).
⏱ Last reviewed: April 2026
How to Convert Decimal to Binary
Binary (base 2) is the foundation of all digital computing. Every number, character, image, and instruction in a computer is ultimately represented in binary — a sequence of 0s and 1s. Converting a decimal (base 10) number to binary is a fundamental skill in computer science, electrical engineering, and mathematics courses at all levels.
The Division-by-2 Method
Binary = remainders of (n÷2) read from bottom to top
Computers use binary because electronic circuits have two stable states: on (1) or off (0). Everything in computing — numbers, text, images, sound, video, programs — is stored and processed as sequences of bits. An 8-bit byte can represent 256 values (0–255). A 32-bit integer can represent over 4 billion values. Understanding binary is essential for programming, networking, cryptography, and digital electronics.
Binary to Decimal Conversion (Reverse)
To convert binary back to decimal, multiply each bit by its positional power of 2 and sum the results. For binary 1101: (1×8) + (1×4) + (0×2) + (1×1) = 8 + 4 + 0 + 1 = 13. Each bit position doubles in value from right to left: 1, 2, 4, 8, 16, 32, 64, 128...
Binary in Programming Languages
Python:bin(13) → '0b1101' | bin(13)[2:] → '1101'
JavaScript:(13).toString(2) → '1101'
Java:Integer.toBinaryString(13) → '1101'
C/C++: Use printf with custom bitshift loop
Excel:=DEC2BIN(13) → 1101 (limit: 511)
💡 Hex shortcut: Each hexadecimal digit represents exactly 4 binary bits. If you know hex, you can convert to binary faster by translating each hex digit directly: A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. For example, 0xFF = 11111111 in binary = 255 in decimal.
Frequently Asked Questions
Divide the decimal number by 2 repeatedly, recording the remainder each time, until the quotient reaches 0. Then read the remainders from bottom to top. Example: 13 → divide: 13/2=6r1, 6/2=3r0, 3/2=1r1, 1/2=0r1 → read bottom to top: 1101.
Decimal 10 in binary is 1010. Division: 10/2=5r0, 5/2=2r1, 2/2=1r0, 1/2=0r1. Reading remainders bottom to top: 1010. Verify: 8+0+2+0=10 ✓. In 8-bit: 00001010.
Decimal 255 in binary is 11111111 — all 8 bits set to 1. This is the maximum value of an 8-bit byte. In hex: FF. Decimal 255 is commonly seen in RGB colors (max channel value), IP subnet masks (255.255.255.0), and byte-level data processing.
The formula uses repeated division by 2: Binary = remainders of (n/2, n/4, n/8...) read in reverse. Alternatively, express n as a sum of powers of 2. In code: bin(n) in Python, n.toString(2) in JavaScript, Integer.toBinaryString(n) in Java.
Use bin(n) — for example bin(13) returns '0b1101'. To get just the digits: bin(13)[2:] returns '1101'. For 8-bit zero-padded output: format(13, '08b') returns '00001101'. For 16-bit: format(13, '016b').
Use the DEC2BIN function: =DEC2BIN(13) returns 1101. For 8-bit padded output: =DEC2BIN(13, 8) returns 00001101. Note: Excel's DEC2BIN has a maximum of 511 (9 bits). For larger numbers, use this online converter or a programming language.
Each bit represents a power of 2 from right to left: bit 0 = 1, bit 1 = 2, bit 2 = 4, bit 3 = 8, bit 4 = 16, bit 5 = 32, bit 6 = 64, bit 7 = 128. An 8-bit byte represents values 0 to 255. A 16-bit word represents 0 to 65,535.
Decimal 100 in binary is 1100100. Breakdown: 64 + 32 + 4 = 100. In 8-bit: 01100100. In hex: 64. This is why 0x64 is a common hex representation of 100 in programming.
Binary (base 2) uses digits 0 and 1. Hexadecimal (base 16) uses 0-9 and A-F. Each hex digit represents exactly 4 binary bits, making hex a compact shorthand for binary. Binary 11111111 = hex FF = decimal 255. Hex is used in programming, memory addresses, and color codes (#FFFFFF = white).
Negative numbers in binary use two's complement. To convert -13 to 8-bit: (1) Write 13: 00001101. (2) Flip all bits: 11110010. (3) Add 1: 11110011. So -13 = 11110011 in 8-bit two's complement. This converter handles positive integers only; two's complement is covered in the step-by-step section for educational reference.
The number of bits needed = floor(log2(n)) + 1. Examples: decimal 7 needs 3 bits (111), decimal 8 needs 4 bits (1000), decimal 255 needs 8 bits, decimal 65535 needs 16 bits, decimal 4,294,967,295 needs 32 bits. Computer systems use fixed widths of 8, 16, 32, or 64 bits.
Decimal 0 in binary is 0. In 8-bit representation: 00000000. Zero is the only number where all bits are 0 (off). In computing, the null byte (0x00 in hex, 00000000 in binary) is used as a string terminator and initialization value for memory.
Decimal 1 in binary is 1. In 8-bit: 00000001. Only the least significant bit (bit 0, representing 2^0 = 1) is set to 1. The number 1 is the same in binary and decimal — it requires only one bit in its minimal representation.