PLC Data Types: IEC Table, Ranges, UDTs | Skill-Lync Resources
Medium PLC & SCADA Ladder Logic Programming

What data types and structures are used in modern PLC programming?

By the Skill-Lync engineering team · Last updated

Answer

PLC data types follow IEC 61131-3: BOOL; the bit strings BYTE, WORD, DWORD and LWORD; signed integers SINT, INT, DINT and LINT (8 to 64 bits); unsigned USINT to ULINT; REAL and LREAL floats; TIME, DATE, TOD and DT; and STRING. Structures build on them: ARRAY, STRUCT (UDT), ENUM and function block instances. An INT holds -32,768 to 32,767.

What are the PLC data types in IEC 61131-3?

IEC 61131-3 defines a fixed set of elementary types: BOOL; the bit strings BYTE, WORD, DWORD and LWORD; signed integers SINT, INT, DINT and LINT; unsigned USINT, UINT, UDINT and ULINT; the floats REAL and LREAL; durations and dates; and the text types CHAR, WCHAR, STRING and WSTRING. The table gives each width and range.

The table follows the 3rd edition (IEC 61131-3:2013). The 4th edition, published in May 2025, adds UTF-8 strings. Every integer range comes straight from the bit width: an unsigned $n$-bit type holds $0$ to $2^n-1$, and a signed one holds $-2^{n-1}$ to $2^{n-1}-1$ in two's complement.

IEC 61131-3 elementary data types
TypeBitsRange or meaning
BOOL1FALSE or TRUE (0 or 1)
BYTE8bit string 16#00 to 16#FF
WORD16bit string 16#0000 to 16#FFFF
DWORD32bit string, 32 bits
LWORD64bit string, 64 bits
SINT8-128 to 127
USINT80 to 255
INT16-32,768 to 32,767
UINT160 to 65,535
DINT32-2,147,483,648 to 2,147,483,647
UDINT320 to 4,294,967,295
LINT64-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
ULINT640 to 18,446,744,073,709,551,615
REAL32±3.4028235e38, about 7 significant digits (IEEE 754 single)
LREAL64±1.7976931348623157e308, about 15 to 16 digits (IEEE 754 double)
TIMEvendorduration; 32-bit milliseconds on S7-1500 and TwinCAT 3
LTIME64duration in nanoseconds
DATE, TOD, DTvendordate, time of day, date and time
CHAR, WCHAR8 / 16one single-byte / double-byte character
STRING, WSTRINGvariabletext of single-byte / double-byte characters

How precise are REAL and LREAL?

REAL is an IEEE 754 single-precision float: 1 sign bit, 8 exponent bits and 23 fraction bits, good for about 7 significant digits up to 3.4028235e38. LREAL is double precision: 64 bits, about 15 to 16 digits, up to 1.7976931348623157e308. Every whole number up to 16,777,216 fits exactly in a REAL; beyond that, gaps appear.

The largest REAL is $(2-2^{-23})\times 2^{127}$. A 24-bit significand gives $\log_{10} 2^{24} \approx 7.22$ decimal digits and LREAL's 53 bits give $\approx 15.95$. Siemens quotes the guaranteed figures: REAL is processed with 6-digit precision, LREAL with 15. Above $2^{24} = 16{,}777{,}216$ neighbouring REALs are 2 apart, so 16,777,217 is stored as 16,777,216.

How do Siemens, Rockwell and Beckhoff differ?

All three use the IEC names for integers and floats, so INT is 16 bits and DINT 32 bits everywhere. They differ in what a BOOL costs in memory, how long a STRING can be, how TIME is stored, what a user-defined type is called, and byte order, which matters the moment data leaves the PLC.

Vendor implementations, from each vendor's own manuals
Siemens S7-1500 (TIA Portal)Rockwell Logix 5000Beckhoff TwinCAT 3
IntegersSINT to LINT, USINT to ULINTSINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINTSINT to LINT, USINT to ULINT
One BOOL uses1 byte in an optimized block4 bytes as a standalone tag; 1 bit of a hidden SINT inside a UDT1 byte (8 bits)
TIME32-bit signed ms, -24d 20h 31m 23s 648ms to +24d 20h 31m 23s 647ms; legacy S5TIME is 16-bit BCD, max 2h 46m 30s64-bit: listed with LINT and LREAL as an 8-byte type32-bit unsigned ms, up to 49d 17h 2m 47s 295ms; LTIME 64-bit ns
STRINGmax 254 characters (the default); uses declared length + 2 bytesLEN plus DATA, a SINT[82]: 82 characters; custom types 1 to 65,535default 80 bytes plus a terminating zero
User typePLC data type (UDT), data held in data blocks (DBs)user-defined data type (UDT)STRUCT (DUT)
Byte orderoptimized blocks little-endian; standard blocks keep the S7-300/400 big-endian layoutlittle-endian (low byte first on the wire)little-endian (Intel)
Struct layoutoptimized blocks sort members by type themselveseach type aligned to its size; UDT size a multiple of 4 bytes8-byte alignment; each type aligned to its size

Rockwell adds one rule that surprises Siemens users: use DINT for integers. A Logix controller works on 32-bit values, so it converts every SINT or INT to DINT before using it and back afterwards, which costs execution time and memory.

What are ARRAY, STRUCT, ENUM and function block instances?

They are derived types built from the elementary ones. An ARRAY is a numbered list of one type. A STRUCT (Siemens: PLC data type; Rockwell: UDT) groups different types under one name. An ENUM gives names to integer states. A function block instance is the memory that keeps one FB's data from scan to scan.

TYPE E_MotorState : (STOPPED := 0, STARTING := 1, RUNNING := 2, FAULTED := 3);
END_TYPE

TYPE ST_Motor :
STRUCT
    SpeedSP   : REAL;   (* rpm setpoint *)
    Current   : REAL;   (* A *)
    Starts    : DINT;   (* start counter *)
    FaultCode : INT;
    Running   : BOOL;
    Fault     : BOOL;
END_STRUCT
END_TYPE

VAR
    Motors : ARRAY[1..20] OF ST_Motor;
    State  : E_MotorState;
END_VAR

Motors[7].Current reads one member of one motor, and a FOR loop or an HMI faceplate can handle any motor by its index. Siemens S7-1500 has named value types for the ENUM role. Every FB instance carries its own copy of the FB's variables: in TIA Portal that is an instance DB, and in TwinCAT each instance also holds a hidden pointer to its method table.

Why does member order change a UDT's size?

The controller places each member at an address that is a multiple of its own size and fills the gaps with padding. A BOOL followed by a REAL leaves 3 empty bytes. Put the large members first and the BOOLs last, and the same data packs tighter: in Skill-Lync's worked example below the motor UDT shrinks from 24 bytes to 16.

Rockwell's rules (Logix 5000 Design Considerations manual): each elementary type of size n is n-byte aligned; consecutive BOOLs share one hidden SINT, 1 bit each; a UDT's size is a multiple of 4 bytes (8 if it holds a 64-bit member). Order A is the motor UDT typed in a natural order; order B is the one in the code above.

MemberTypeOffset, order AOffset, order B
RunningBOOL0 (own SINT)14 (shared SINT, bit 0)
SpeedSPREAL40
FaultBOOL8 (own SINT)14 (shared SINT, bit 1)
CurrentREAL124
FaultCodeINT1612
StartsDINT208
Size24 bytes (8 pad)16 bytes (1 pad)
Byte map of the motor UDT: order A uses 24 bytes with 8 padding bytes, order B uses 16 bytes with 1 padding byte Order A: 24 bytes Order B: 16 bytes 04812162004812 BSpeedSP REALBCurrent REALFaultCodeStarts DINT SpeedSP REALCurrent REALStarts DINTFaultCodeB pad byte 4 bytes per row B = hidden SINT holding the BOOL bits
Rows are 4 bytes. Same six members, same data: order A wastes 8 bytes on padding. An ARRAY[1..200] of the UDT needs 4,800 bytes in order A and 3,200 in order B.

TwinCAT 3 gives the same 24 and 16 bytes for this struct, because it also aligns each member to its own size. Siemens optimized blocks reorder members themselves. Padding still matters when a whole UDT crosses a network: Rockwell sends the pad bytes on the wire, so an HMI or SCADA driver reading the UDT as one block must know the layout.

Which data type bugs cause real faults?

Three come up again and again: an INT that wraps from 32,767 to -32,768, a REAL totalizer that quietly stops counting, and a REAL or DINT that arrives garbled over Modbus because its two 16-bit registers were read in the wrong order. Each is a data type choice, not a logic error.

INT overflow at 32,767

32,767 is 16#7FFF. Add 1 and the pattern becomes 16#8000, which an INT reads as -32,768. An INT counting seconds wraps after 32,768 s, about 9 h 6 min. A signed 32-bit millisecond count, the Siemens TIME, runs out at $2^{31}$ ms = 24 d 20 h 31 min 23.648 s. Use DINT for counters, and LINT or ULINT for counts that run for years.

The REAL totalizer that stops counting

A REAL holds every whole number up to $2^{24}$ = 16,777,216; from there, adding 1 changes nothing. Small increments fail much sooner. Skill-Lync ran a REAL that adds 0.1 per scan through IEEE single-precision arithmetic. After 1,000,000 scans it reads 100,958.34 instead of 100,000 (+0.96%). After 10,000,000 it reads 1,087,937 instead of 1,000,000 (+8.8%). At 2,097,152 it freezes, because REALs there are 0.25 apart and adding 0.1 rounds back to the same value. In a 100 ms task that happens after 18,073,720 scans, about 20.9 days.

REAL totalizer adding 0.1 per scan versus the true total: the REAL runs high, then freezes at 2,097,152 after 18,073,720 additions 01M2M3M 010M20M30Madditions of 0.1 (scans) true total REAL total +8.8% REAL stuck at 2,097,152
Single-precision sums computed step by step, the way a PLC adds one scan at a time. The dashed line is what the totalizer should read.

Fixes: keep the running total in an LREAL, or count whole pulses in a DINT or LINT and scale only for display, or move the REAL into a separate accumulator before it grows large.

REAL and DINT over Modbus

Modbus registers are 16 bits, and the specification sends each one big-endian, most significant byte first. It does not say which register of a 32-bit value comes first, so devices differ. 123.45 as a REAL is 16#42F6E666: high word first, the registers are 16#42F6 then 16#E666. A client that expects the low word first decodes -2.718e23. A DINT of 100,000 (16#000186A0) read with its words swapped becomes -2,036,334,591. When a value looks absurd, swap the words before blaming the sensor.

Try it: what does the PLC actually store?

Type a number and pick a type. The inspector shows the stored bit pattern and hex, whether the value overflowed or was rounded, the bytes in big- and little-endian order, and the Modbus registers in both word orders. It runs in your browser and sends nothing anywhere.

Rounded: REAL really stores 123.4499969482421875 (error -3.051758e-6). Next REAL up is 7.629395e-6 away.

Bit pattern
01000010111101101110011001100110
Hex
16#42F6E666
Bytes, big-endian (S7 standard block, Modbus)
42 F6 E6 66
Bytes, little-endian (Logix, TwinCAT, S7-1500 optimized)
66 E6 F6 42
Modbus, high word first
16#42F6, 16#E666
Modbus, low word first
16#E666, 16#42F6
Read in the wrong word order
-2.718449e+23

REAL and LREAL bits: sign exponent fraction. Integer types: sign bit on signed types.

Common interview follow-ups

Why does Rockwell recommend DINT instead of INT?
Logix controllers compare and manipulate values as 32-bit DINTs or REALs. A SINT or INT is converted to DINT before use and back afterwards, which costs execution time and memory, so Rockwell's tag data manual says to use DINT for integers wherever possible.
What is the difference between WORD and INT?
Both are 16 bits. INT is a signed number for arithmetic; WORD is a bit string for masks and status words. The same pattern 16#FFFF is 65,535 as a UINT, -1 as an INT and sixteen set bits as a WORD.
What is S5TIME?
A 16-bit BCD duration kept for S7-300/400 compatibility: three BCD digits plus a time base of 10 ms, 100 ms, 1 s or 10 s, up to 2 h 46 min 30 s. TIA Portal accepts it only on S7-300, S7-400 and S7-1500, so IEC TIME is the portable choice.
What does optimized block access change on an S7-1500?
TIA Portal sorts the block's tags by type to avoid gaps, stores each BOOL as a byte, keeps values in the CPU's little-endian order and allows only symbolic access. Standard blocks keep the old big-endian layout and absolute offsets, at the cost of byte swapping on every access.
How much memory does one BOOL take?
It depends on where it lives: 1 bit of a hidden SINT inside a Logix UDT, 4 bytes as a standalone Logix tag, 1 byte in TwinCAT 3 and in an S7-1500 optimized block.

Related PLC and SCADA questions

Want to work with bits, bytes and registers hands-on?

Skill-Lync does not run a dedicated PLC course today. The nearest programs sit on the embedded and automation side, where integer widths, floats, byte order and fieldbus registers are daily work: compare Skill-Lync's embedded systems courses and IoT courses.

See embedded systems courses
Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

PLC Programmer Automation Engineer Control Systems Engineer