Bits, bytes, words and integer types

BOOL, BYTE, WORD, DWORD, signed and unsigned integers, two's complement, INT16/UINT16/INT32/UINT32 ranges and IEC 61131-3 types.

Units

UnitBitsIEC 61131-3 typeExample
bit1BOOLdigital input, flag
byte8BYTE16#A5
word16WORDModbus register, status word
double word32DWORDtwo Modbus registers
long word64LWORDfour registers

BYTE/WORD/DWORD are bit strings: a set of bits with no numeric meaning. For arithmetic the data is interpreted as a signed or unsigned integer.

Unsigned and signed integers

IEC typeBitsRange
USINT / SINT80…255 / −128…127
UINT / INT160…65535 / −32768…32767
UDINT / DINT320…4294967295 / −2147483648…2147483647
ULINT / LINT640…2⁶⁴−1 / −2⁶³…2⁶³−1

Device specifications often call the same types UINT16, INT16, UINT32, INT32.

Two's complement

Negative numbers are stored in two's complement: the top bit is 1 and the value equals the unsigned value minus 2ⁿ.

16 bit: 0xFFFF = 65535 unsigned = −1 signed
        0x8000 = 32768 unsigned = −32768 signed
        0xFF38 = 65336 unsigned = −200 signed

The bit pattern is the same — only the interpretation changes. A temperature of −20.0 °C sent as INT16 with a factor of 10 arrives as 0xFF38; read as UINT16 by a SCADA it displays as 6533.6 °C.

Overflow

Out-of-range values wrap around: 32767 + 1 in INT16 gives −32768. Pulse and run-hour counters stored as UINT16 overflow after 65,536 counts — use UDINT/ULINT for accumulation or handle the wrap-around.

Hex and binary notation

One hex digit is exactly 4 bits (a nibble), so hex suits bit data: 0x1028 = 0001 0000 0010 1000 — bits 3, 5 and 12 are set. IEC 61131-3 literals are written 16#1028 and 2#0001_0000_0010_1000.

Tools

  • Number Converter — DEC/HEX/BIN/OCT for 8–64 bit, signed and unsigned, overflow detection.
  • Bit / Byte Tool — set and clear individual bits, bit masks.

Loading the map…

Sources

  1. IEC 61131-3:2025 Programmable controllers — Part 3: Programming languages — IEC
  2. PLCopen — IEC 61131-3 — PLCopen

Updated 2026-10-01