Binary Sequence Generator

Enumerates every binary number of a user-chosen bit width in strict ascending order, from all-zeros to all-ones, zero-padded and newline-separated. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Sometimes you don't want a single binary conversion, you want to see every possible value of a given width at once, for example every 4-bit nibble, to build a truth table or a lookup reference by hand.

This tool enumerates that full sequence for you, in order, so you can copy the complete list instead of incrementing a counter manually.

What Is Binary Sequence Generator?

A generator that lists every binary number of a chosen bit width, from all-zeros up to all-ones, one per line.

It's the binary equivalent of counting from 0 up to 2^width - 1, but with each value already rendered in zero-padded binary form.

How Binary Sequence Generator Works

The tool validates the requested width, then loops over every integer from 0 to 2^width - 1.

Each integer is converted to a binary string with `Number.prototype.toString(2)` and left-padded with zeros to the target width, and the resulting rows are joined with newlines.

When To Use Binary Sequence Generator

Use it to build a reference table of every possible bit pattern for a given field width, such as every combination of 4 flag bits.

It's also handy for teaching binary counting, since the output visibly increments one bit at a time just like decimal counting.

Features

Advantages

  • Produces the complete, correctly-ordered set of values with no manual incrementing.
  • Consistent zero-padding makes the output easy to scan or paste into a table.
  • Instant, deterministic, fully client-side.

Limitations

  • Capped at a 16-bit width (65,536 rows) to avoid generating an unmanageably large output in the browser.
  • Only produces unsigned values counting from zero; it doesn't support a custom start/end range within the width.

Examples

All 2-bit binary values

Input

width = 2

Output

00
01
10
11

There are 2^2 = 4 possible 2-bit values, counted in order from 00 to 11.

All 3-bit binary values

Input

width = 3

Output

000
001
010
011
100
101
110
111

There are 2^3 = 8 possible 3-bit values, each zero-padded to 3 digits.

Best Practices & Notes

Best Practices

  • Keep the width as small as the field you're actually modeling; a full 16-bit sequence is rarely needed for manual review.
  • Copy the output straight into a spreadsheet column if you're cross-referencing each value against another representation (hex, decimal).

Developer Notes

Implemented with a plain loop from 0 to 2^width - 1, formatting each value via `toString(2)` and `padStart`; width is capped at 16 rather than using BigInt, since the row count itself (not integer size) is the limiting factor.

Binary Sequence Generator Use Cases

  • Building a complete truth-table input column for a given number of bits
  • Generating reference lookup tables for small binary fields
  • Teaching binary counting by showing the full ordered sequence

Common Mistakes

  • Requesting a large width (like 20+) expecting instant output, without accounting for how fast 2^width grows.
  • Assuming the sequence supports a custom starting value; it always starts at all-zeros.

Tips

  • Combine this with a hex or decimal converter to build a side-by-side multi-base reference table.
  • For just a handful of specific values rather than the full range, a manual binary converter is more direct than this enumerator.

References

Frequently Asked Questions