HCODX/Decimal to Binary
100% browser-based · Batch conversion · Padding + prefix options

Decimal to Binary

Convert decimal numbers to binary in your browser. Optional 0b prefix, zero-padding to a fixed width, and grouping every 4 or 8 bits for readability.

Decimal numbers
Binary values
Conversion options
Reverse (Binary → Decimal)
Input size
0 B
Output size
0 B
Numbers
0
Status
Ready
Example

Decimal in, binary out

Each decimal number is emitted as a base-2 string, with optional zero padding to a fixed width.

Decimal
10
15
42
Binary
1010
1111
101010
Use cases

What you'll use this for

Anywhere you need to see the underlying bits of a decimal value — bitmasks, debugging, hardware specs.

Bit twiddling

Inspect the on/off pattern of a decimal value to spot a bad flag.

CS homework

Verify base-10 to base-2 conversions for assignments and study.

Bitmask design

Design bitmasks by writing the decimal value and reading the bit pattern.

Hardware

Encode register values and protocol fields with exact bit widths.

Step by step

How to convert decimal to binary

1

Paste decimal numbers

One per line or separated by spaces or commas. Negative values are skipped.

2

Pick width and grouping

Pad to 4 / 8 / 16 / 32 bits, group bits for readability, and optionally prefix with 0b.

3

Click Convert

Or leave auto-convert on for live updates. Runs entirely in your browser.

4

Copy the result

Copy to clipboard or download as .txt. Round-trip with the reverse tool if you need to verify.

FAQ

Frequently asked questions

53 bits (the JS safe-integer limit). Negative numbers are skipped.

Yes — use the Pad width option (4 / 8 / 16 / 32 bits).

Yes.

Newlines, spaces, or commas — any combination.

Yes — use Binary to Decimal.

About

About this converter

This tool converts numbers from base 10 (decimal) to base 2 (binary). Internally it calls n.toString(2), then optionally zero-pads the result to a fixed bit-width and groups bits for readability.

How conversion works

  • Input is split on whitespace and commas into individual decimal tokens.
  • Each token is parsed with parseInt(token, 10) — negatives are skipped.
  • The bit-string is left-padded with zeros up to the requested width, then optionally split into groups.

Why pad?

  • Fixed bit-width matters when bits represent a register, a flag set, or a protocol field.
  • Grouping by 4 or 8 bits makes long bitstrings easier to read at a glance.
  • 0b prefix matches the syntax used by JS, Python, and Rust for binary literals.
Related

Related tools