Ladder Logic for Beginners: Free PLC Simulator & Practice Lab
Ladder logic is a graphical way of programming a programmable logic controller (PLC). Contacts test conditions, branches combine them and output instructions change values. The same basic ideas are used in automated production, packaging and other industrial control systems.
Try our free Factory Logic Lab to learn how to read and build ladder diagrams, predict what happens during a scan, and troubleshoot 17 original exercises. No previous programming experience, account or hardware is required.
Start here: Choose the first lesson, make a prediction, toggle the virtual button and select Single scan. Move on to Build, Simulate and Troubleshoot when you're comfortable. Check your answers or run the automatic behavior tests. Your lesson progress is stored locally in this browser when storage is available.
Factory Logic Lab
Read the logic. Predict the result. Make the virtual machine respond.
Read diagram as text
| Tag | Type | Physical | Logic | Published |
|---|
What is a PLC?
A programmable logic controller (PLC) is an industrial computer designed to monitor inputs and control outputs according to a stored program. PLCs are used in automated production systems, packaging equipment, material handling and many other industrial settings. A PLC can keep checking a sensor and deciding what to do long after the person who wrote its program has gone home.
A typical system contains a processor, memory and input/output (I/O) interfaces. Digital inputs represent two states, such as detected or not detected. Analog inputs represent measured quantities, such as temperature or position, using numeric values. Output instructions can request actions or update internal variables. Real equipment needs appropriate interfaces, electrical design and safety systems.
Ladder Diagram (LD), commonly called ladder logic, is a graphical programming language. It resembles relay-control diagrams, with vertical rails and horizontal rungs. The current IEC 61131-3:2025 standard (Edition 4) specifies Ladder Diagram, Function Block Diagram and Structured Text; it also defines Sequential Function Chart elements for structuring programs and function blocks. Older controllers and programming environments may support other languages. The simulator on this page teaches a small, vendor-neutral subset of ladder logic, not every instruction in the standard.
Ladder logic symbols and instructions for beginners
Read a rung from left to right. A contact tests a condition, a series connection requires multiple conditions to pass, and a parallel branch permits alternative paths. A coil or function block at the end of the rung performs an action. In this lab, a thick solid line and a PASS label indicate an active logical path; a dashed line indicates a blocked path. The diagram represents logical conditions, not actual voltage or current.
| Instruction | Symbol in lab | What it does | Example vendor name |
|---|---|---|---|
| Test true | | | | Passes when the referenced bit is true (1). | Rockwell XIC; NO contact |
| Test false | |/| | Passes when the referenced bit is false (0). | Rockwell XIO; negated/NC contact |
| Output coil | ( ) | Writes the rung's current result to a Boolean tag. | Rockwell OTE |
| Set / reset | (S) / (R) | Sets or clears a stored bit when the rung is true; otherwise leaves it unchanged. | Rockwell OTL / OTU |
| Rising edge | |↑| | Detects a transition from false to true; produces a one-scan condition in the lab. | CODESYS R_TRIG; Rockwell one-shot family |
| On-delay | TON | Turns its done bit on after the enabling condition persists for the preset time. | TON |
| Off-delay | TOF | Turns on immediately, then delays turning off after its enabling condition falls. | TOF |
| Count up | CTU | Increments on a rising edge of the count condition, with a reset input. | CTU |
| Compare | =, ≠, >, ≥, <, ≤ | Tests a number against a threshold. | Comparison instructions |
Normally open and normally closed: a common misconception
A physical normally open or normally closed device describes hardware behavior in its normal state. A ladder contact tests a value in the PLC program. Those are separate concepts. For example, Rockwell's XIC instruction passes a true condition when the selected bit is true, and its XIO instruction passes it when that bit is false. Neither symbol alone tells you how a physical sensor is wired.
Try lesson 2: Set ObjectPresent to 0 and advance a scan. The negated contact passes, and the ClearLamp turns on. Change ObjectPresent to 1 and scan again. The same instruction now blocks the condition.
How does a PLC scan cycle work?
PLC programs often run repeatedly in cycles. A useful introductory model is to sample inputs, execute the program, update outputs and repeat. In a real controller, task scheduling, interrupts and I/O configuration can change how and when those operations occur. For instance, the Siemens S7-1200 cyclic execution documentation describes publishing the output image before sampling new inputs and executing the program.
In this simulator: Every scan copies the virtual physical inputs into sampled memory. Rungs run in displayed order. A write to a memory or output tag is visible to later rungs during that scan. At the end, the new output values are published to the virtual scene, and 100 milliseconds of simulated time have elapsed. A paused input change is not sampled until another scan runs. The speed control changes the rate of scans, not their simulated duration.
For the rung-order lesson, the first rung reads RunFlag to determine StatusLamp; the second rung writes RunFlag from Start. Start begins true and RunFlag begins false. On the first scan, the lamp stays off even though the flag becomes true. On the second, the lamp turns on. It's not a defective lamp: the first rung simply read the old value. The tag inspector and scan trace reveal why.
Real controllers are not universally identical to this model. It does not simulate asynchronous I/O, task priorities, interrupts, real signal electrical characteristics or vendor-specific startup and retention rules.
Ladder logic examples: AND, OR, NOT and memory
Two contacts in series (AND)
|----[ ModeReady ]----[ PartReady ]----( ReadyLamp )----|
The virtual lamp turns on only when both ModeReady and PartReady are true. Try lesson 3, then change the two inputs individually. A single test case isn't enough to prove the program works: all four possible combinations matter.
Two parallel contacts (OR)
|----+----[ RequestA ]----+----( RequestLamp )----| | | | | +----[ RequestB ]----+
Either request can light the lamp, including when both requests are true. In the editor, use + OR alternative to create a parallel condition and + AND condition to add a series group.
| A | B | A AND B | A OR B | NOT A |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 |
How can ladder logic remember a request?
An ordinary coil follows the rung result each time that rung executes. To remember a virtual request after its input returns to false, lesson 6 uses a memory tag as a parallel feedback condition. The memory bit can keep its own rung true until a virtual stop request interrupts that logical path. This is often called seal-in logic.
Lesson 7 teaches a different technique: SET and RESET instructions. They change the stored flag only when their respective conditions are true. If both execute in one lab scan, the later active write wins. This is the lab's convention; real instruction priority and retention depend on the platform and configuration.
A rising-edge instruction is useful when you want to respond to a new event instead of a sustained condition. In this lab, each edge contact keeps its own history, starts with the initial bit value and produces a pulse for one scan when the bit changes from 0 to 1.
PLC timers and counters: practice with time and events
Timers use elapsed time to influence a condition. Counters record events. The CODESYS TON, TOF and CTU documentation provides familiar examples of these function blocks. Other PLC platforms may use different representations or detailed timing rules.
On-delay timer (TON)
In lesson 8, the preset is 500 ms. Each active scan adds 100 ms of simulated time. After five consecutive active scans, the timer's Q (done) bit becomes true. If the enabling input becomes false, the elapsed time (ET) and Q reset. Try interrupting the request after two scans and starting again.
Off-delay timer (TOF)
With an off-delay, the Q bit turns true immediately when the condition is true. In lesson 9, after FanRequest changes to false, the fan icon stays on for the first two 100 ms scans and turns off on the third. Re-enabling the request cancels the current off-delay.
Count up (CTU)
Consider the virtual package sensor in lesson 10. When a box first reaches the sensor, its bit changes from false to true. If the same box stays there for four scans, a count-up instruction should count one event, not four. The sensor must return to false before another rise is detected.
| Scan | Sensor | Rising edge? | Current value (CV) | Q |
|---|---|---|---|---|
| 1 | 0 | No | 0 | 0 |
| 2 | 1 | Yes | 1 | 0 |
| 3 | 1 | No | 1 | 0 |
| 4 | 0 | No | 1 | 0 |
| 5 | 1 | Yes | 2 | 1 |
The lab counts rising edges of the complete enabling condition, uses a reset tag when specified, and caps the displayed count at 999. Its deliberately broken Scan increment instruction is a teaching fault, not a standard PLC instruction. A held-high count condition during reset does not create a fresh rising edge on release of reset.
How to troubleshoot ladder logic in the simulator
Don't start by changing instructions at random. Learn to distinguish the symptoms from the cause. Use the virtual input controls, single scan, ladder display and inspector together.
| Symptom | What to inspect in the lab |
|---|---|
| Output never turns on | Find the first blocked condition. Check whether its tag has the value you expected. |
| Output turns off when a request ends | Is it an ordinary coil rather than stored state? Check the feedback or SET/RESET lesson. |
| Counter increases too quickly | Hold the input true for several scans. A count-up block should not add a count on every scan. |
| Timer never finishes | Check whether the enabling condition keeps dropping and resetting elapsed time. |
| Output changes later than expected | Read the order of rungs and compare the before/after values in the scan trace. |
| Program appears correct but sensor disagrees with the scene | Compare the virtual object position, physical input value and sampled input. |
For an extra challenge, try the packaging sequence. Its faulty starter counts every active scan instead of detecting events. Repair it and run the acceptance tests. The tests execute a fresh copy of your program with scripted inputs, so your manual input changes do not affect the results. Passing tests means the program meets the exercise's specified behavior, not that it is safe or suitable for real equipment.
How to learn PLC programming without hardware
You can learn Boolean logic and basic scan behavior on a laptop or phone without a PLC. Use a progression that gives you a reason to move from simple programs to more capable environments:
- Read contacts, coils and parallel paths until you can predict the result without running a program.
- Build and test simple Boolean rungs, then add memory and timer/counter instructions.
- Practice diagnosing faults and explaining differences between expected and observed values.
- Explore a specific manufacturer's documentation and software when you're ready for its exact instruction behavior.
- Get supervised hands-on training with actual equipment, sensors, I/O modules, test instruments and industrial safety procedures.
If you are starting from scratch, try our multimeter simulator, Ohm's law calculator and blueprint reading practice lab to develop adjacent skills. Our mechanical aptitude test is another way to explore technical concepts.
Safety boundary: This is an educational model of fictional equipment. Ordinary ladder logic is not a substitute for a properly designed and validated safety system, machine guarding or hazardous-energy control. See OSHA's hazardous-energy control standard and machine-guarding requirements. Do not use the lab to design, validate, wire or operate real machinery.
Careers that use PLC programming skills
If you enjoyed the troubleshooting more than the building, that's useful information. Industrial automation careers involve understanding what equipment is doing, testing whether signals are correct and diagnosing failures, not simply writing new programs all day.
| Career path | Where PLC knowledge fits |
|---|---|
| Mechatronics and automation | Combining mechanical, electronic and control systems; testing and maintaining automated equipment. |
| Industrial maintenance | Diagnosing equipment problems, interpreting input signals and maintaining production machinery. |
| Electrical and electronic technology | Working with industrial control circuitry, instruments and automated systems. |
| Robotics technician | Diagnosing and maintaining robotic and automated production systems. |
| Instrumentation and controls technician | Working with sensors, measurement, control systems and process diagnostics. Specific duties vary by employer. |
| Building automation technician | Working with computerized building controls; equipment and programming platforms vary. |
O*NET lists PLC software for mechatronics technologists and technicians, industrial machinery mechanics, electrical and electronic engineering technologists and technicians and robotics technicians. These are different roles, not interchangeable job titles. O*NET's robotics specialty also lists instrumentation and controls technician among its reported titles; actual jobs may map to different occupations.
What to ask a school about PLC and automation training
The Bureau of Labor Statistics describes mechatronics technicians as combining mechanical and electrical/electronic knowledge. Associate-degree programs commonly include algebra, trigonometry and science. Other maintenance and electrical pathways can have different entry requirements.
- Which PLC brands and programming environments do students use? Are those the systems local employers use?
- How much supervised lab time involves actual hardware, sensors, input/output modules and fault-finding?
- Do students troubleshoot existing programs as well as write new ones?
- Does the curriculum include electrical fundamentals, analog signals, timers, counters, human-machine interfaces (HMIs) and networking?
- How are electrical safety, hazardous-energy control and machine guarding taught?
- What credential does the program award, and what additional training or supervised experience might an employer require?
Compare mechatronics, PLC and automation technician schools, industrial maintenance programs, robotics and automation training and electronics programs to find the mix of skills you want to develop.
Frequently asked questions
Is ladder logic difficult to learn?
Basic contacts and coils can be learned without previous coding experience. State, timers, counters and program order take more practice. Building small examples and testing each input combination is a useful way to progress.
Can I practice PLC programming online for free?
Yes. This lab is free and runs in a browser, with no account or PLC hardware. It provides 17 original exercises. More advanced vendor software and hardware trainers are useful when you need platform-specific practice.
Is this the same as a Rockwell, Siemens or CODESYS PLC?
No. The lab has a simplified deterministic scan model and generic instruction labels. It does not emulate a specific controller, implement the full IEC standard or produce programs that can be uploaded to equipment.
Does completing the lab certify me to program PLCs?
No. Lesson completion records your practice in this browser. It is not an industry credential, safety qualification or guarantee of employability.
Sources and methodology
Technical references were checked November 25, 2026: IEC 61131-3:2025 (Edition 4); Rockwell Automation Studio 5000 and FactoryTalk Design Studio instruction documentation (bit instructions, output coil); Siemens STEP 7 cyclic execution documentation; CODESYS Standard library (rising edge, TON, TOF, CTU); OSHA 29 CFR 1910.147 and 1910.212; O*NET occupational profiles and BLS Occupational Outlook Handbook. The virtual equipment, examples and exercises are original educational scenarios. The hero is an AI-generated illustration of an automation training environment, not a photograph of an actual school.