Decimal to Binary Converter Online

Convert any decimal integer to binary with step-by-step powers-of-two expansion. Batch mode for hundreds of values, all four bases shown side-by-side — 100% in your browser.

Enter a decimal number to see all four base representations.

What is decimal to binary conversion?

Decimal to binary conversion rewrites a base-10 number using only the digits 0 and 1. Computers store every integer this way at the hardware level, so understanding the mapping is fundamental to programming, networking, and computer architecture.

The OpenFormatter decimal-to-binary converter works in your browser — no upload, no rate limit, no account. It shows the binary result, plus hexadecimal and octal for context, plus a step-by-step expansion that explains exactly which powers of two add up to the input.

How to convert decimal to binary — 4 steps

  1. Enter a decimal number. Type any non-negative integer up to 9,007,199,254,740,991 (253−1).
  2. Read the binary output. The result panel highlights the binary string and also shows hex and octal for completeness.
  3. Study the expansion. The powers-of-two breakdown below the result explains how each set bit contributes to the total — invaluable for learning bit math.
  4. Switch to batch mode. Toggle Batch and paste many decimals (one per line) to get a full conversion table you can copy.

Sample input and output

Input:  42

Output:
  Decimal: 42
  Binary:  101010
  Hex:     0x2A
  Octal:   0o52

Expansion: 42 = 32 (2^5) + 8 (2^3) + 2 (2^1) = 101010₂

The expansion makes the conversion concrete: each 1 bit is a power of two that you sum to get back to decimal. This is exactly how a CPU's adder reconstructs the number from the bit pattern.

Single + Batch Modes

Convert one number for an in-depth view, or paste hundreds of numbers (one per line) for a full table you can copy to a spreadsheet.

Educational Expansion

Every conversion shows the powers-of-two breakdown so you understand why the bits are what they are — perfect for students and bootcampers.

Client-Side Only

All math runs in your browser via Number.prototype.toString(2). Nothing is uploaded — verify it yourself in the DevTools Network tab.

Common use cases

  • check_circleProgramming exercises — converting integer literals while learning bitwise operators
  • check_circleNetworking — converting subnet masks (255.255.255.0 → 11111111.11111111.11111111.00000000)
  • check_circleEmbedded systems — translating sensor readings and register values for an MCU
  • check_circleComputer architecture courses — exploring two's complement, sign extension, and overflow
  • check_circleReverse engineering — decoding protocol fields, flag bits, and packed bitfields
  • check_circleFile permissions — reading chmod values (e.g. 755 → rwxr-xr-x via octal/binary)
  • check_circleCryptography labs — XOR, modular arithmetic, and visualizing bit patterns
  • check_circleJob interviews — quickly working out powers of two and bit positions on a whiteboard

The conversion math, explained

Internally, the tool calls JavaScript's built-in Number.prototype.toString(2), which implements the standard division-by-2 algorithm: repeatedly divide by 2, collect remainders, reverse. For 42 that becomes 42→21 r0, 21→10 r1, 10→5 r0, 5→2 r1, 2→1 r0, 1→0 r1 — read bottom-up, that is 101010. Equivalently, find the largest power of two ≤ 42 (which is 32 = 25), subtract, and repeat: 42−32=10, 10−8=2, 2−2=0 → bits set at positions 5, 3, 1 → 101010. Both views give the same answer; the second is what the expansion panel shows.

Need the reverse direction?

Try the rest of the OpenFormatter base toolkit — every conversion runs in your browser.

Frequently Asked Questions

What is binary?

Binary is a base-2 number system that represents values using only two digits: 0 and 1. Each position is a power of two — bit 0 is 2^0 (1), bit 1 is 2^1 (2), bit 2 is 2^2 (4), and so on. Computers use binary at the hardware level because transistors are inherently two-state devices (on/off, high/low voltage).

How does decimal to binary conversion work?

Repeatedly divide the decimal number by 2 and record each remainder. Read the remainders in reverse order to get the binary digits. For example, 42 ÷ 2 = 21 r0, 21 ÷ 2 = 10 r1, 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1 → reading bottom-up gives 101010. JavaScript implements this with (n).toString(2).

What is the largest decimal I can convert?

This tool accepts integers up to Number.MAX_SAFE_INTEGER, which is 9,007,199,254,740,991 (2^53 − 1). Beyond that, JavaScript numbers lose precision and the binary representation is no longer reliable. For arbitrary-precision conversion, use a BigInt or a dedicated big-integer library.

Why does the tool show hex and octal too?

Once you have a numeric value, every base is just a different representation of the same number. Showing all four side-by-side helps you build intuition — you start to see, for example, that hex F = binary 1111 = decimal 15 = octal 17. This is invaluable when reading register dumps, color codes, or file permissions.

Can I convert negative numbers?

This converter accepts non-negative integers only. Real systems represent negative numbers using two's complement, which depends on the bit width (8-bit, 16-bit, 32-bit, 64-bit). For two's complement conversion, decide a bit width first and then convert (2^n − |x|) for the negative value.

How do I read a long binary string?

Group the bits into nibbles (4-bit groups) from the right. Each nibble maps directly to one hex digit: 0000=0, 0001=1, 0010=2, … 1110=E, 1111=F. So 11010110 reads as 1101 0110 = D6 in hex. Grouping by 3 bits from the right gives octal — that is why hex and octal are popular shorthand for binary.

Does the batch mode have a limit?

There is no hard limit. The tool processes one line per number entirely in memory. Tens of thousands of values render in milliseconds. If a line is empty or invalid, the row shows an error so you can spot it without breaking the rest of the batch.

Is the input sent to a server?

No. Every conversion happens in JavaScript inside your browser. Open DevTools → Network and confirm: clicking Convert makes zero network requests. Safe to use with internal IDs, configuration values, or any data you cannot paste into a remote tool.

Decimal to Binary Converter Online — Free Base-10 to Base-2 Tool