PLC ladder logic is a graphical programming language used to control industrial machinery. It looks like a circuit diagram, with two vertical lines (called rails) connected by horizontal lines (called rungs) that contain inputs on the left and outputs on the right. It was designed to mimic the relay-based wiring diagrams that electricians already knew, making it the easiest PLC language for plant floor workers to read, troubleshoot, and modify. As of 2025, ladder logic holds roughly 46.8% of the PLC programming market, making it the most widely used language in industrial automation.
Why Ladder Logic Exists
Before programmable controllers existed, factories controlled machines using physical cabinets full of electromechanical relays wired together. The wiring diagrams for those cabinets happened to look like ladders: two vertical power lines with horizontal rows of switches and coils between them. When PLCs replaced those relay cabinets decades ago, engineers needed a programming method that electricians could pick up without learning a text-based coding language. Ladder logic was the answer. It kept the familiar visual layout of relay circuits but moved everything into software, where changes could be made in minutes instead of hours of rewiring.
How a Ladder Diagram Is Structured
Every ladder logic program has the same basic anatomy. Two vertical lines, called rails, run down the left and right edges of the screen. They represent the two sides of a power supply. In a physical relay circuit, current would flow from the left rail to the right rail. In the PLC program, the same idea applies: logic flows from left to right.
Connecting the two rails are horizontal lines called rungs, numbered sequentially from top to bottom. Each rung is its own line of logic. On the left side of a rung, you place input conditions (sensors, switches, internal flags). On the right side, you place the output (a motor, valve, indicator light, or internal bit). The PLC reads the program starting at rung 1, evaluating left to right, then moves down to the next rung, continuing from top to bottom until it reaches the last rung.
Basic Instructions: Contacts and Coils
The three most fundamental symbols in ladder logic are contacts and coils, borrowed directly from relay circuit terminology.
- Examine If Closed (XIC): Drawn as two short vertical lines with a gap between them, this represents a normally open contact. It checks whether a bit is on. If the bit is on (1), the instruction is true and allows logic to pass through. Think of it as asking, “Is this switch closed right now?”
- Examine If Open (XIO): Drawn the same way but with a diagonal slash through it, this represents a normally closed contact. It works in reverse: it’s true when the bit is off (0). It asks, “Is this switch still open?” This is how you build NOT logic, where you want something to happen only when a condition is absent.
- Output Energize (OTE): Drawn as a pair of parentheses, this represents a relay coil. When all the input conditions on its rung evaluate as true, the output turns on. When any required condition goes false, the output turns off.
Building Logic: AND, OR, and NOT
Every decision a PLC makes boils down to combinations of three logical operations, and ladder logic makes them visual.
To create AND logic, you place two contacts in series on the same rung, one after the other. Both must be true for current to reach the output. Imagine two switches wired end to end: the light only comes on if both are flipped.
For OR logic, you place contacts on parallel branches. Either path can carry the logic to the output. If contact A or contact B is true, the output energizes. At least one path needs to be complete.
NOT logic uses the normally closed contact (XIO). A lamp energizes when the contact is not activated, and turns off when it is. You can combine these three operations freely. A rung might have two parallel branches (OR), each containing two series contacts (AND), with one of those contacts inverted (NOT). Complex decisions are built entirely from these simple pieces.
The PLC Scan Cycle
Understanding how the PLC actually runs your ladder program matters, because it doesn’t work the way a desktop computer runs code. The PLC operates in a continuous loop called the scan cycle, which has three stages.
First, the PLC reads every physical input and saves a snapshot of their states into memory. It doesn’t check inputs again mid-program. Second, the PLC executes your ladder logic from the first rung to the last, using that stored snapshot to evaluate all conditions. As it processes each rung, it saves the results for the outputs temporarily. Third, after the last rung executes, the PLC writes all the output results at once, turning physical outputs on or off. Then the cycle starts over. This entire loop typically takes just milliseconds, so it feels instantaneous, but it means that changes to inputs during program execution won’t be picked up until the next scan.
Timers and Counters
Beyond simple on/off logic, most real programs need to track time and count events. Ladder logic handles both with built-in instructions.
An on-delay timer (commonly called TON) starts counting time when its input condition becomes true. Once a preset duration elapses, its “done” bit turns on, which you can use as a contact on another rung. If the input condition drops out before the time expires, the timer resets. This is useful when you need a delay before an action, like waiting five seconds after a sensor triggers before starting a conveyor.
An up-counter (CTU) increments by one each time its input transitions from false to true. Once the accumulated count reaches a preset value, its done bit turns on. Counters are used for things like counting parts on a production line or tracking how many times a door has opened. Both timers and counters store a preset value (your target) and an accumulated value (the current count or elapsed time), and both can be reset by separate instructions on other rungs.
The Seal-In Circuit: A Common Pattern
One of the first practical patterns you’ll encounter is the seal-in circuit, also called a latching circuit. The problem it solves is simple: a start button is momentary, meaning it’s only true while your finger is pressing it. But you want a motor to keep running after you release the button.
The solution uses the output’s own contact to hold itself on. On a single rung, you wire the start button in parallel with a normally open contact tied to the motor output. A normally closed stop button goes in series with both. When you press start, the motor energizes. The motor’s own contact then closes, creating a parallel path around the start button. Releasing the start button doesn’t matter because the motor’s contact is now keeping the rung true. Pressing the stop button breaks the series path, de-energizing the motor and dropping out its seal-in contact. This pattern appears in nearly every motor control application and is one of the building blocks of industrial programming.
Strengths and Limitations
Ladder logic dominates industrial automation for good reasons. Its graphical layout means electricians and maintenance technicians can read and troubleshoot it without formal programming training. During live operation, most PLC software animates the diagram: contacts and coils change color when energized, so you can see logic solving in real time. When a machine goes down at 3 a.m., a technician can open the program and quickly trace which conditions are met and which aren’t. This visual debugging is a significant advantage over text-based languages, where you’d need separate monitoring tools to check variable states.
Ladder logic also resists certain types of software errors. The PLC scans every rung from top to bottom, first pass to last, every cycle. There are no loops that can hang or recursive calls that can overflow. The program runs predictably every time.
Where ladder logic struggles is with complex data handling. Tasks like manipulating text strings, processing arrays of data, performing floating-point math, or managing recipe systems become cumbersome when represented graphically. For these tasks, text-based languages like Structured Text are more compact and expressive. Ladder logic also doesn’t port easily between PLC brands, since each manufacturer uses slightly different instruction sets and addressing conventions. Most experienced programmers use ladder logic for straightforward digital control and switch to other languages when the task demands heavier data processing.

