CLK Digital Logic Simulator

Binary Counter Simulator

Simulate a digital binary counter with adjustable bit width, up or down direction, modulo value and starting state. Apply individual clock pulses or run the counter automatically and inspect binary states, decimal values, overflow, wraparound and bit transitions.

✓ Up Counter ✓ Down Counter ✓ Mod-N Counter ✓ Clock Pulses ✓ Wraparound ✓ Bit Visualization
CNT
Binary Counter Simulation
● Ready
Maximum binary state depends on bit width.
Increment or decrement on each clock pulse.
Decimal initial counter state.
For a standard 4-bit counter use modulo 16.
Current Counter State 0000 = 0
Counter Status Ready
Current Decimal
Current Binary
Previous Value
Clock Pulses
Counter Width
Modulo
Wrap Count
Direction
Latest Transition
Counter History
Counter Configuration

What Is a Binary Counter?

A binary counter is a sequential digital circuit that moves through a series of binary states in response to clock pulses. Each pulse changes the stored counter value according to the counter direction and modulus.

For a normal n-bit binary up counter, the state increases by one until the largest representable value is reached. The next pulse causes the counter to wrap back to zero.

How to Use the Binary Counter Simulator

Choose a counter width, select whether the counter should count upward or downward, enter its starting decimal value and specify the desired modulus. Press Clock Pulse to advance the counter by one state.

You can also select Auto Run to generate repeated simulated clock pulses. Stop halts automatic counting, while Reset returns the simulator to the configured starting state.

4-Bit Binary Counter Example

A standard four-bit binary counter has 16 possible states because four bits can represent values from decimal 0 through 15.

Decimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 ... 14 1110 15 1111 Next clock pulse: 0000

Binary Counter State Formula

For an ordinary modulo-N up counter, the next state can be represented as the current state plus one modulo N.

Up counter: Next = (Current + 1) mod N Down counter: Next = (Current - 1 + N) mod N

Adding N before taking the modulo in the down-counter expression prevents a negative result when the current state is zero.

What Is a Modulo Counter?

The modulus specifies the number of distinct states in the counting cycle. A four-bit binary counter naturally supports 16 states and is therefore a modulo-16 counter when its entire range is used.

Counters can deliberately use a smaller modulus than their available binary width. For example, a four-bit modulo-10 counter cycles through decimal values 0 through 9 rather than using states 10 through 15.

Decade Counter Example

A decade counter has ten states and is therefore also called a modulo-10 counter. Four binary bits are required because three bits provide only eight possible combinations.

0 = 0000 1 = 0001 2 = 0010 3 = 0011 4 = 0100 5 = 0101 6 = 0110 7 = 0111 8 = 1000 9 = 1001 Next pulse: 0 = 0000

Up Counter vs Down Counter

Counter Type Operation Example
Up Counter Increases by one per clock 0010 → 0011
Down Counter Decreases by one per clock 0011 → 0010
Modulo Counter Wraps at a selected number of states 1001 → 0000 for mod-10

Binary Counter Overflow and Wraparound

When an up counter reaches its final state, the next clock pulse causes the value to return to zero. This behavior is commonly called overflow or wraparound.

4-bit modulo-16 counter: 1110 = 14 1111 = 15 0000 = 0 Wrap occurred.

A down counter exhibits the reverse behavior. When it is at zero and receives another pulse, it wraps to the highest valid state.

How Many States Does an n-Bit Counter Have?

A full binary counter with n bits has 2 raised to the power n possible states.

Bits States Decimal Range
2 4 0–3
3 8 0–7
4 16 0–15
8 256 0–255
16 65,536 0–65,535

Binary Counter Bit Transitions

Binary counters exhibit a recognizable transition pattern. The least significant bit changes on every clock pulse, while higher-order bits change less frequently.

4-bit count: 0000 0001 0010 0011 0100 0101 0110 0111 1000

In a simple binary counter, bit 0 toggles every pulse, bit 1 every two pulses, bit 2 every four pulses and bit 3 every eight pulses.

Uses of Binary Counters

Binary counters are fundamental building blocks in digital electronics. They are used in frequency division, timers, event counting, address generation, digital clocks, state machines, microcontrollers, memory systems and many other sequential circuits.

Counter simulation is useful for students learning digital logic as well as engineers verifying state sequences and modulo behavior before implementing a hardware design.

Binary Counter Simulator FAQs

What is a binary counter?
A binary counter is a sequential logic circuit that advances through binary states when clock pulses are applied.
How many states does a 4-bit counter have?
A full four-bit binary counter has 2⁴ = 16 states, covering decimal values 0 through 15.
What is a modulo-10 counter?
A modulo-10 counter has ten states. It normally counts from 0 through 9 and then returns to zero.
What happens after 1111 in a 4-bit up counter?
For a standard modulo-16 four-bit counter, the next state after 1111 is 0000.
What happens before 0000 in a down counter?
A modulo down counter wraps from zero to its highest valid state.
What is the least significant counter bit?
Bit 0 is the least significant bit. In a normal binary counter it changes on every counting transition.
Can the modulus be smaller than 2 to the power of the bit width?
Yes. For example, four bits can support 16 binary states but may be configured as a modulo-10 counter using only states 0 through 9.
What is counter overflow?
Overflow occurs when an up counter advances beyond its maximum valid state and wraps back to its first state.
Does this simulator generate a real hardware clock?
No. It simulates digital counter state changes in the browser. The clock pulses represent logical counter events rather than electrical signals.
Can I simulate an 8-bit counter?
Yes. Select 8 bits to simulate states up to 255 when using the full modulo-256 range.
Scroll to Top