Ladder Logic: A Beginner's Guide to PLC Ladder Diagrams With Examples
PLC Programming

Ladder Logic: A Beginner's Guide to PLC Ladder Diagrams With Examples

What ladder logic is, how a PLC reads a ladder diagram, the symbols you need to know, and four worked PLC examples you can build yourself: start/stop, interlock, timer and counter.

πŸ“… November 2, 2026 ⏱ 12 min read Β· 2 diagrams Β· 3 tables ✍️ Dr. Ahsan Rahman, PhD, P.E.

Quick summary: Ladder logic is the most widely used language for programming PLCs (programmable logic controllers). A program is drawn as a ladder diagram: two vertical rails with horizontal rungs between them, where each rung connects input conditions (contacts) to an output (a coil). It was designed to look like the relay wiring diagrams electricians already knew. This guide explains how a PLC reads ladder logic, the main symbols, four practical PLC examples, how ladder logic compares with other PLC languages, and how to start learning it for free.

Walk into almost any factory, water plant or packaging line and the machines are run by PLCs. Open the program inside most of those PLCs and you will see the same thing: a ladder diagram.

I have taught PLC programming to university students and to engineers in industry for many years, and ladder logic is always where we start. It is visual, it is easy to troubleshoot, and once you understand a few symbols you can read programs written for real machines.

This guide takes you from zero to writing your first useful ladder programs.

01 What Is Ladder Logic?

Definition

Ladder logic is a graphical programming language used to program PLCs. The program is drawn as a ladder diagram: two vertical lines called rails, joined by horizontal lines called rungs. Each rung contains conditions on the left, called contacts, and an action on the right, usually a coil. If the conditions on a rung are true, the output turns on.

You will also hear it called a ladder logic diagram or simply a diagram of the PLC program. It is called ladder logic because the diagram looks like a ladder. The left rail represents the power supply, the right rail represents the return, and each rung is one line of logic that the PLC checks.

Ladder logic grew out of relay logic. Before PLCs, machines were controlled by cabinets full of electromechanical relays wired together. When PLCs arrived, engineers wanted a programming language that electricians and technicians could understand without learning to code. The ladder language copied the look of relay wiring diagrams, so the move from relays to PLCs was easy. Today ladder logic is standardised as Ladder Diagram (LD), one of the PLC programming languages defined in the international standard IEC 61131-3.

πŸ’‘

Think of each rung as an "if, then" sentence. "If the start button is pressed and the stop button is not pressed, then run the motor." That one sentence is one rung of ladder logic.

02 How a PLC Reads a Ladder Diagram

A PLC does not run a ladder diagram once. It runs it over and over in a loop called the scan cycle. Each scan has three main steps:

  1. Read inputs: the PLC checks every input, such as buttons, switches and sensors, and stores their states in memory.
  2. Execute the program: it solves the ladder diagram rung by rung, from top to bottom, and each rung from left to right, using the stored input states.
  3. Update outputs: it writes the results to the outputs, such as motors, lamps and valves.

The time one complete cycle takes is called the scan time. On a typical PLC it is a few milliseconds, which is why the machine seems to react instantly. Because rungs are solved in order, the position of a rung in the program can change the result. That matters when you start writing longer programs.

03 Ladder Logic Symbols You Need to Know

You can read most ladder diagrams once you know these basic symbols. Exact names differ slightly between PLC brands; the Allen-Bradley names are shown in brackets.

SymbolNameWhat it does
--| |--Normally open contact (XIC)True when the input or bit is ON. Passes "power" along the rung.
--|/|--Normally closed contact (XIO)True when the input or bit is OFF.
--( )--Output coil (OTE)Turns ON when the rung is true, and OFF when it is false.
--(L)--Latch / set coil (OTL)Turns ON and stays ON, even after the rung becomes false.
--(U)--Unlatch / reset coil (OTU)Turns a latched output OFF.
[TON]On-delay timerWaits a set time after the rung becomes true, then sets its "done" bit.
[CTU]Up counterCounts each time the rung goes from false to true; sets "done" at the preset value.
[EQU] [GRT]Compare blocksCompare two values, for example equal to or greater than.

Contacts can be placed in series, one after another, which works like AND: all must be true. They can also be placed in parallel on branches, which works like OR: any one can be true. With series, parallel and NC contacts you can build any logic: AND, OR and NOT.

04 PLC Ladder Logic Examples

These four PLC examples cover the patterns you will use in almost every real program. Input and output names are shown in a general form; the addresses will depend on your PLC brand.

Example 1: Motor start/stop with seal-in

This is the classic first ladder logic program. Press START and the motor runs. Release START and the motor keeps running. Press STOP and the motor stops.

Ladder diagram for a motor start and stop circuit with seal-in contact One rung. A normally open START contact, with a MOTOR contact in parallel below it, is in series with a normally closed STOP contact and the MOTOR output coil. START STOP MOTOR MOTOR NO contact NC contact output coil ← seal-in (holding) contact
Figure 1: Start/stop circuit with a seal-in contact. The MOTOR contact in parallel with START keeps the rung true after START is released. ↔ swipe to see the whole diagram

How it works: when START is pressed, power flows through START and the closed STOP contact to the MOTOR coil. The MOTOR coil also closes the MOTOR contact on the branch below START. Now, even when START is released, power flows through that branch, so the motor stays on. This is called a seal-in or holding circuit. Pressing STOP opens the rung, the coil turns off, the seal-in contact opens, and the motor stays off until START is pressed again.

⚠️

Real-world safety note: the diagram uses a normally open STOP button for simplicity. In real installations, stop buttons are usually wired as normally closed buttons, and programmed with a normally open (XIC) contact. That way, if the wire breaks, the machine stops instead of becoming impossible to stop. Emergency stops must also be handled by a proper safety circuit, not by ordinary PLC logic alone.

Example 2: Forward and reverse interlock

A motor that can run forward or reverse must never get both commands at once, or it can trip the supply or damage the motor. You prevent this with an interlock: put a normally closed REVERSE contact in the FORWARD rung, and a normally closed FORWARD contact in the REVERSE rung.

  • Rung 1: FWD_START, in parallel with FORWARD, in series with STOP and NC REVERSE, drives the FORWARD coil.
  • Rung 2: REV_START, in parallel with REVERSE, in series with STOP and NC FORWARD, drives the REVERSE coil.

While FORWARD is on, its NC contact in rung 2 is open, so REVERSE cannot start. In real panels, an electrical interlock on the contactors is added as well.

Example 3: Delayed start with an on-delay timer

A conveyor should start 5 seconds after the RUN switch is turned on, to give a warning horn time to sound.

Ladder diagram for a delayed start using an on-delay timer Rung one: a RUN contact enables a TON timer T1 with a preset of 5 seconds. Rung two: the timer done bit T1.DN turns on the CONVEYOR coil. RUN TON T1 Preset: 5 s Done bit: T1.DN T1.DN CONVEYOR Rung 1Rung 2
Figure 2: On-delay timer. When RUN is on, timer T1 counts to 5 seconds, then its done bit T1.DN turns on the conveyor. ↔ swipe to see the whole diagram

When RUN turns on, timer T1 starts timing. After 5 seconds, its done bit T1.DN becomes true, so rung 2 turns on the CONVEYOR. When RUN turns off, the TON timer resets and the conveyor stops. You could also use the timer's "timing" bit to sound the horn during those 5 seconds. Chapter 7 of PLC Pulse covers TON, TOF and RTO timers in detail.

Example 4: Counting boxes with an up counter

A proximity sensor detects boxes on a conveyor. After 10 boxes, the conveyor stops and a "box full" lamp turns on.

  • Rung 1: the BOX_SENSOR contact drives an up counter C1 with a preset of 10. Each time a box passes, the count goes up by one.
  • Rung 2: the counter's done bit C1.DN turns on the FULL_LAMP coil.
  • Rung 3: an NC C1.DN contact is placed in the conveyor rung, so the conveyor stops when the count is reached.
  • Rung 4: a RESET button drives a reset instruction (RES) for C1, ready for the next carton.

Counters only count when the rung changes from false to true, so a box standing in front of the sensor is counted once, not on every scan. See Chapter 8 on PLC counters for more counter programs.

05 Ladder Logic vs Other PLC Languages

The IEC 61131-3 standard defines several PLC programming languages. Most modern PLCs support more than one, and many programs mix them.

LanguageStyleBest for
Ladder Diagram (LD)Graphical, like relay wiringDiscrete on/off logic, interlocks, easy troubleshooting by technicians
Function Block Diagram (FBD)Graphical blocks connected by linesProcess control, PID loops, analog signals
Structured Text (ST)Text, similar to PascalMaths, loops, data handling and complex algorithms
Sequential Function Chart (SFC)Steps and transitionsMachine sequences and batch processes
Instruction List (IL)Low-level text, like assemblyOlder programs; now deprecated in the standard

Ladder logic remains the most common choice for machine control in many regions because maintenance technicians can read it on screen and see exactly which contact is stopping a rung.

06 Advantages and Limitations of Ladder Logic

βœ“ ADVANTAGES

  • Easy to learn, especially with an electrical background
  • Visual: you can watch rungs turn true or false live
  • Fast troubleshooting on the plant floor
  • Supported by almost every PLC brand
  • Ideal for on/off logic and interlocks

βœ— LIMITATIONS

  • Awkward for complex maths and data handling
  • Large programs can become long and hard to follow
  • Not ideal for loops and arrays
  • Less portable between brands than plain text code
  • Needs good naming and comments to stay readable

07 How to Learn Ladder Logic

1

Learn the basics of digital logic

AND, OR and NOT, and how they map to series contacts, parallel branches and NC contacts. Chapter 4 of PLC Pulse covers this step by step.

2

Use a free PLC simulator

Tools such as OpenPLC and CODESYS are free, and major brands offer trial software. You can write and test ladder diagrams without any hardware.

3

Build the four examples above

Start/stop, interlock, timer and counter. Change them, break them and fix them. These patterns appear in almost every real program.

4

Move on to real machine problems

Traffic lights, tank level control, bottle filling and conveyor sorting. The free PLC Pulse book includes more than 80 worked PLC programming examples like these.

5

Test yourself

Use the PLC practice questions to check your understanding, especially before exams or job interviews.

08 Common Beginner Mistakes

βœ—

Using the same output coil on two rungs

The PLC solves rungs top to bottom, so only the last rung "wins". Combine the conditions into one rung, or use latch and unlatch deliberately.

βœ—

Confusing the field device with the contact symbol

A physical NC button and an NC instruction are not the same thing. Decide how each device is wired first, then choose the contact that gives the logic you want.

βœ—

Forgetting the seal-in

Without a holding contact, a motor started by a push button stops as soon as the button is released.

βœ—

Ignoring scan order

A rung that uses a bit set lower in the program sees the old value until the next scan. Order your rungs on purpose.

βœ—

No names or comments

"I0.3" means nothing six months later. Use clear tag names such as CONVEYOR_RUN and add a short comment to every rung.

Want Hands-On PLC Training?

Dr. Ahsan Rahman runs two-level PLC and industrial automation training, from ladder logic basics to timers, counters and real industrial case studies, online or in person.

See PLC Training β†’

09 Frequently Asked Questions

What is ladder logic in PLC?

Ladder logic is a graphical programming language used to program PLCs. The program is drawn as a ladder diagram with two vertical rails and horizontal rungs. Each rung has input conditions, called contacts, on the left and an output, usually a coil, on the right. When the conditions on a rung are true, the output turns on.

Why is it called ladder logic?

Because the diagram looks like a ladder. The two vertical power rails are the sides of the ladder, and each line of logic between them is a rung. The format was copied from the relay wiring diagrams that electricians used before PLCs existed.

What is a PLC ladder diagram?

A PLC ladder diagram is the visual form of a ladder logic program. It shows contacts, coils, timers, counters and other instructions arranged on rungs between two rails. The PLC reads it from top to bottom and left to right on every scan.

Is ladder logic hard to learn?

No. Ladder logic is one of the easiest programming languages to start with, especially for people with an electrical background. Most beginners can write simple start/stop, timer and counter programs within a few days of practice using a free PLC simulator.

What is the difference between ladder logic and structured text?

Ladder logic is graphical and works best for on/off control, interlocks and easy troubleshooting. Structured text is a text-based language, similar to Pascal, that works best for maths, loops and complex data handling. Many PLC programs use both.

What is scan time in a PLC?

Scan time is the time a PLC takes to complete one full cycle: read all inputs, solve the whole program and update all outputs. It is usually a few milliseconds and depends on the PLC and the size of the program.

Can I learn ladder logic for free?

Yes. Free simulators such as OpenPLC and CODESYS let you write and test ladder programs without hardware. The free online book PLC Pulse by Dr. Ahsan Rahman covers ladder logic, timers, counters and more than 80 worked PLC examples.

β˜… Final Thoughts

Ladder logic has outlived the relays it was designed to replace because it does one thing very well: it makes machine logic visible. A technician can stand in front of a machine, open the ladder diagram and see exactly why a motor will not start.

Learn the symbols, build the four examples in this guide, and practise on real machine problems. Within a few weeks you will be reading and writing the same kind of PLC programs that run factories around the world.

🎯

One thing to do today: install a free PLC simulator and build Example 1, the start/stop seal-in circuit. Then remove the seal-in contact and watch what happens. That one experiment teaches more than a page of theory.

AR

Written by Dr. Ahsan Rahman, PhD, P.E.

Dr. Ahsan Rahman is an Associate Professor and Head of Electrical Engineering at the University of Prince Mugrin, with a PhD in control, mechatronics and system design. He has taught PLCs as a core undergraduate course for many years, delivers ladder and PLC programming workshops for engineers in industry, and is the author of the free online book PLC Pulse. Learn more β†’ Β· Contact β†’

Subscribe to our newsletter

Get an email when a new article or free book is published. No spam, unsubscribe any time.

πŸ”’ We only use your email to send new posts. Unsubscribe with one click.