IEC 61131-3 Explained: PLC Languages, Structure and Best Practices

By editor 7 min read
PLC programming window showing Structured Text beside a ladder rung and the IEC 61131-3 language names

IEC 61131-3 is the international standard for PLC programming. It defines the programming languages, data types and software structure used by programmable controllers. The current version is Edition 4, published on 22 May 2025. It covers Ladder Diagram (LD), Function Block Diagram (FBD) and Structured Text (ST), with Sequential Function Chart (SFC) for structuring sequences. Instruction List (IL) was removed in this edition.

LanguageTypeBest forStatus in Edition 4
Ladder Diagram (LD)GraphicalDiscrete logic and easy fault-findingIncluded
Function Block Diagram (FBD)GraphicalProcess control and signal flowIncluded
Structured Text (ST)TextualMath, data handling and algorithmsIncluded
Sequential Function Chart (SFC)StructuringMachine and batch sequencesIncluded
Instruction List (IL)TextualLegacy programsRemoved
IEC 61131-3 languages at a glance.
Reader tip: Vendors do not all implement every feature of the standard. Before designing around a feature, check that your PLC and its software version support it.
Edition 4
Current version
2025
Year published
3 + SFC
Languages plus sequencing
3
Classic POU types

What Does IEC 61131-3 Cover?

IEC 61131 is a multi-part standard for programmable controllers, and Part 3 deals with programming. Its value is a common structure. An engineer who understands tasks, function blocks and typed variables can read a well-organized program on many platforms, even when the editor looks different. If you are new to the hardware, start with our guide to what a PLC is.

Timeline of IEC 61131-3 editionsEditions were published in 1993, 2003, 2013 and 2025. The third edition added object-oriented programming and deprecated Instruction List, and the fourth removed it.IEC 61131-3 editions1993First editionFive languages defined2003Second editionStandard revised2013Third editionOOP added, IL deprecated2025Fourth editionIL removedIndustrialBasicsindustrialbasics.com
Figure 1: Edition 4 was published on 22 May 2025.

What changed in Edition 4

ChangeWhat it means for you
Instruction List removedPlan to migrate legacy IL code over time
Octal literals removedCheck older code that uses them
Synchronization addedMutex and semaphore concepts for concurrent execution
USTRING and UCHAR addedUTF-8 text is now supported by the standard
Selected Edition 4 changes as reported in published edition comparisons.

The IEC 61131-3 Software Model

The standard organizes a control project into levels. Understanding them is the key to designing a program that remains readable as the machine grows.

IEC 61131-3 software modelA configuration contains resources. Each resource runs tasks, each task runs programs, and programs call function blocks and functions.The IEC 61131-3 software modelConfiguration: the whole control systemResource 1: CPUFast task: 10 msProgram: MotionFunction blockFunction blockFunctionSlow task: 100 msProgram: ProcessFunction blockFunction blockFunctionResource 2: CPUFast task: 10 msProgram: MotionFunction blockFunction blockFunctionSlow task: 100 msProgram: ProcessFunction blockFunction blockFunctionIndustrialBasicsindustrialbasics.com
Figure 2: Each level contains the one below it. Task times shown are examples.
ElementWhat it isPractical example
ConfigurationThe complete control softwareThe whole PLC project
ResourceA processing facilityA CPU
TaskDecides when code runsCyclic, interval or event-triggered
ProgramTop-level code unitConveyor or filling station
Function blockReusable code with memoryMotor, valve, timer or PID
FunctionReusable code without memoryScaling or limit calculation
The main levels of the software model.

Function vs function block

This is the most important design distinction. A function has no memory, so the same inputs always give the same output. A function block keeps its state between scans, and each instance has its own data. That is why one motor block can be reused for a hundred motors, each with its own timer and alarm state.

The IEC 61131-3 Languages Compared

The same logic in Ladder, Function Block Diagram and Structured TextThe motor runs when Start is true and Stop is false, shown as a ladder rung, an AND block with an inverted input, and one line of Structured Text.The same logic in three languagesLadder Diagram (LD)Function Block Diagram (FBD)Structured Text (ST)StartStopMotorANDStartStopMotorMotor := Start AND NOT Stop;IndustrialBasicsindustrialbasics.com
Figure 3: A simplified example showing that the languages can express the same logic.
LanguageStrengthsWeaknesses
LDFamiliar to electricians, easy to monitor onlineAwkward for math and data
FBDClear signal flow, good for loopsLarge diagrams can sprawl
STCompact, strong for calculationsHarder for some maintenance staff
SFCMakes the sequence visibleOverkill for simple logic
Choose the language by the job, not by habit.

Most good projects mix languages: SFC for the machine sequence, LD or FBD for device logic and ST for calculations. Consider who will maintain the machine at 3 a.m. Readability often matters more than clever code.

How to Structure a PLC Program

  1. Define the machine and break it into units, such as infeed, process and outfeed.
  2. List the devices in each unit: motors, valves, sensors and drives.
  3. Build one function block per device type, then reuse it.
  4. Separate the layers: input mapping, device control, sequence, alarms and output mapping.
  5. Assign tasks by speed. Put fast control in a fast task and slow monitoring in a slower one.
  6. Use typed data structures instead of loose global variables.
  7. Write each output in one place only, so its behavior is easy to trace.
  8. Test blocks on their own before integrating them, using simulation where possible.

Worked example: a reusable motor block

This Structured Text block starts and stops a motor, latches faults and raises an alarm if the running feedback does not arrive within 3 seconds.

FUNCTION_BLOCK FB_Motor
VAR_INPUT
    Start    : BOOL;    (* momentary start command *)
    StopOK   : BOOL;    (* TRUE when no stop is requested *)
    Fault    : BOOL;    (* overload or drive fault *)
    Feedback : BOOL;    (* contactor or drive running *)
    Reset    : BOOL;
END_VAR
VAR_OUTPUT
    Run   : BOOL;
    Alarm : BOOL;
END_VAR
VAR
    tFeedback : TON;
END_VAR

tFeedback(IN := Run AND NOT Feedback, PT := T#3S);

IF Fault OR tFeedback.Q THEN
    Alarm := TRUE;
ELSIF Reset THEN
    Alarm := FALSE;
END_IF;

Run := (Start OR Run) AND StopOK AND NOT Alarm;
END_FUNCTION_BLOCK

Each motor then becomes one instance of the same block, so a fix in the block applies to all of them.

PROGRAM Conveyor
VAR
    M101 : FB_Motor;
    M102 : FB_Motor;
END_VAR

M101(Start := Cmd_Start, StopOK := Line_OK, Fault := OL_101,
     Feedback := Aux_101, Reset := Cmd_Reset);
M102(Start := M101.Run, StopOK := Line_OK, Fault := OL_102,
     Feedback := Aux_102, Reset := Cmd_Reset);

KM_101 := M101.Run;
KM_102 := M102.Run;
END_PROGRAM
Safety note: This is a teaching example. Emergency stops and guarding must use a safety-rated system designed to the applicable standards, not standard PLC logic like this. See our guide to NFPA 79 for machine stop categories.

The same pattern works well for loops. A PID function block instance can be placed in a fixed-interval task, and our PID tuning guide explains how to set it up.

IEC 61131-3 Best Practices

PracticeWhy it helps
Use consistent namingMakes signals easy to find and search
Avoid magic numbersNamed constants explain the intent
Limit global variablesReduces hidden dependencies
Keep blocks smallEasier to test and reuse
Comment the reasonThe code already shows what it does
Handle bad inputsA failed sensor should lead to a safe, known state
Use version controlShows what changed and when
Watch the scan timeHeavy code can delay fast tasks
Habits that keep PLC programs maintainable.

Larger systems also need clear boundaries between the controller and supervisory software. Our comparison of PLC, DCS and SCADA explains where each one fits.

Frequently Asked Questions

What is IEC 61131-3?

IEC 61131-3 is the international standard for programmable controller languages. It defines the programming languages, data types and software structure used by PLCs and similar controllers.

What are the IEC 61131-3 languages?

The current edition covers Ladder Diagram, Function Block Diagram and Structured Text, plus Sequential Function Chart for structuring sequences. Instruction List was removed in Edition 4.

What is the latest edition of IEC 61131-3?

Edition 4.0 was published on 22 May 2025 and replaces the 2013 edition.

Was Instruction List removed from IEC 61131-3?

Yes. It was deprecated in the third edition and removed in the fourth. Some vendors may continue to offer it, so existing programs do not suddenly stop working.

What is a POU in IEC 61131-3?

POU stands for Program Organization Unit. The three classic POUs are the function, the function block and the program.

What is the difference between a function and a function block?

A function has no memory, so the same inputs always give the same result. A function block keeps its internal state between executions, which is why timers and counters are function blocks.

Which IEC 61131-3 language is best?

It depends on the job. Ladder suits discrete logic and maintenance, FBD suits process control, ST suits calculations and data handling, and SFC suits sequences. Many projects combine them.

Are PLC programs portable between IEC 61131-3 brands?

Only partly. Vendors implement different subsets and add their own extensions and libraries, so code usually needs some rework. PLCopen XML can help exchange projects between tools that support it.

Sources and Further Reading

About the author

editor

Leave a Comment