Ladder Logic Simulator
Write simple ladder rungs as text, switch the inputs on and off, and watch current flow through a live ladder diagram: seal-in circuits, timers, counters and interlocks.
How it works
Each line of the program is one rung. Contacts to the left of the = sign are in series; brackets with a bar, such as (START | MOTOR), are parallel branches. A name on its own is a normally open contact (passes power when the tag is on) and a name with a slash, such as /STOP, is normally closed. The instruction after the = sign is the output of the rung.
OUT name: the output follows the rung (on when power reaches it).SET nameandRST name: latch an output on, and reset it (also resets a timer or counter).TON name seconds: on-delay timer. It accumulates time while the rung is true and resets when false. Usename.DNas a contact for its done bit.CTU name count: up counter that counts each time the rung goes from false to true. Usename.DNfor the done bit andRST nameto clear it.
The simulator scans the rungs from top to bottom every 100 ms of simulated time, like a PLC: a rung sees the result of the rungs above it in the same scan, but only the previous scan for the rungs below it. The ideas behind this are on Ladder Logic in Practice.
Worked example
Load the first example. Click START and the rung (START | MOTOR) /STOP = OUT MOTOR is true, so the MOTOR output turns on. Click START again to release it: the MOTOR contact in the parallel branch keeps the rung powered, so the motor stays on. This is the seal-in (holding) circuit used on motor starters. The second rung starts a 3 second timer while the motor runs and the third rung turns the lamp on when the timer is done. Click STOP and the normally closed contact breaks the rung, the motor drops out, and the timer resets.
Things to know
This is a teaching simulator with a small instruction set. Real PLCs add comparison, math, one-shots and retentive timers, and each brand names them differently.
The latching example shows why stop buttons are wired normally closed: a broken wire stops the motor, a safe failure. In a real machine, safety functions must use safety-rated devices, not just ladder logic.
Timers are checked each 100 ms scan, so times are accurate to one scan.
Real scan order matters: moving a rung changes behavior. Try swapping the lamp rung above the timer rung to see the one-scan lag.
Common questions
Why does the lamp lag one scan behind the timer?
Because the rung that reads the timer done bit is above the rung that sets it in some programs, so it sees the old value. A PLC does the same.
Can I save my program?
Copy it from the box. The program is not stored on the server.
Is this IEC 61131-3?
It follows the ladder diagram idea of the standard, but the text format here is our own simple notation.
Sources
- IEC 61131-3, Programmable controllers: Programming languages (ladder diagram, function block diagram, structured text).
- Petruzella, F., Programmable Logic Controllers (ladder logic fundamentals).
Last reviewed: November 2, 2026
