Decimal to Binary Converter

How the conversion works

Binary is base 2 — every digit position represents a power of 2 (1, 2, 4, 8, 16...) instead of a power of 10. To convert, the tool repeatedly divides your decimal number by 2 and reads the remainders in reverse order, which is exactly what JavaScript's toString(2) does internally.

Worked example

Take the decimal number 42. It breaks down as 32 + 8 + 2 = 101010 in binary (1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42). Type 42 into the field above and the tool returns 101010.

A second example: 255

255 is a common one in networking and color codes — it's 11111111 in binary (eight 1s, since 255 = 128+64+32+16+8+4+2+1), and it's the maximum value a single byte can hold.

Input limits

This converter only handles non-negative whole numbers. Decimals and negative values will produce a "please enter a valid number" message rather than a binary result, since JavaScript's built-in conversion doesn't have a standard way to represent negative or fractional binary here.