M12 Coding Guide: Match the Connector to the Job
The coding is the keying pattern molded into the M12 face. It tells you what the connection carries (signal, Ethernet data, or power) and physically stops a plug from mating with the wrong socket. Codings are not interchangeable, so confirm the coding on the device datasheet before you choose pin count, length, or jacket.
| Coding |
Carries |
Pin counts in this category |
Typical uses |
| A-coded | Signals and low-power DC | 3, 4, 5, 8, 12 | Proximity and photoelectric sensors, valves, I/O blocks, IO-Link, DeviceNet and CANopen |
| B-coded | Fieldbus data | 2, 4, 5 | PROFIBUS networks |
| D-coded | Industrial Ethernet up to 100 Mbit/s | 4 | PROFINET, EtherNet/IP, and EtherCAT field devices; M12 to RJ45 cordsets |
| X-coded | Industrial Ethernet up to 10 Gbit/s | 8 | Machine vision cameras, Gigabit backbones, Cat6A runs |
| L-coded | DC power | 4 + FE, 5 | Power distribution to PROFINET and EtherNet/IP I/O blocks and field devices |
| T-coded | DC power | 4 | Compact DC power feeds to field devices |
| S-coded and K-coded | AC power | 3 + PE (S), 4 + PE (K) | Motors, small drives, and other AC loads |
Ratings vary by manufacturer and part. For example, Turck's L-coded M12 power family carries up to 14 A, and its L-coded receptacles are rated 63 V. Always confirm voltage and current on the datasheet for the exact part number.
Choosing an M12 Cordset
| Decision |
Options |
How to choose |
| Ends | Single-ended, double-ended | Single-ended when the far end lands on terminals in a panel. Double-ended when both the device and the I/O block, switch, or junction box have M12 ports. |
| Gender | Female (socket), male (plug) | Match the opposite of the device port. Most sensors have a male M12 port, so the device end of the cordset is female. |
| Orientation | Straight, right-angle | Right-angle heads save space where the cable has to turn tight against a bracket, guard, or I/O block. |
| Jacket | PVC, PUR, TPE | PVC for general fixed wiring. PUR is the common choice for drag chains and moving cables. TPE is used on many Turck Ethernet and power cordsets. Check the datasheet for drag-chain, oil, weld-spatter, and washdown ratings. |
| Shielding | Unshielded, shielded | Use shielded cable for Ethernet, fieldbus, encoder, and analog signals, and anywhere near drives and motor leads. |
| Length | Fixed lengths per part | Measure the routed path, not the straight-line distance. For a length that isn't offered, pair a field wireable connector with bulk cable. |
Ordering Tips That Prevent Returns
- Coding first, then pins. A 4-pin D-coded Ethernet cordset will not mate with a 4-pin A-coded sensor port, even though the pin count matches.
- Check the pin count on both ends. Y-splitters, M12 to M8 cables, and adapter cables often change pin count from one end to the other.
- Ethernet speed sets the coding. Use D-coded for 100 Mbit/s networks and X-coded for Gigabit devices such as vision cameras. For cabinet switches, choose an M12 to RJ45 cordset.
- Seal unused ports and torque the coupling nut. Protective caps keep open ports at their rated protection class. Baumer specifies 0.6 Nm for its M12 coupling nuts, and torque sleeves and torque wrench sets in the Adapters and Accessories category help crews tighten to spec.
- Power codings are not interchangeable. L, T, S, and K-coded connectors are keyed differently, so match the coding printed on the device or the power supply.
M12 Connector FAQ
What does the coding on an M12 connector mean?
The coding is the keying pattern on the connector face, identified by a letter such as A, B, D, X, or L. Each coding is assigned to a type of connection: A-coded for sensors and I/O, B-coded for PROFIBUS, D and X-coded for Industrial Ethernet, and L, T, S, and K-coded for power. The keying prevents a plug from mating with a socket of a different coding.
What is the difference between D-coded and X-coded M12?
D-coded M12 is a 4-pin connector for Industrial Ethernet up to 100 Mbit/s, used on most PROFINET, EtherNet/IP, and EtherCAT field devices. X-coded M12 is an 8-pin connector that supports Ethernet up to 10 Gbit/s over Cat6A cable, which makes it the standard for Gigabit devices such as machine vision cameras. The two are keyed differently and cannot be mated.
Which M12 coding is used for PROFINET?
PROFINET data connections on field devices typically use D-coded M12 for 100 Mbit/s, or X-coded M12 for Gigabit links. Power to PROFINET I/O blocks is typically supplied over L-coded M12, which is keyed for DC power and includes a functional earth contact. Confirm both ports on the device datasheet before ordering.
Should I buy a single-ended or double-ended M12 cordset?
Buy a single-ended cordset when one end will be landed on terminals inside a control panel, since it has an M12 connector on one end and open wire leads on the other. Buy a double-ended cordset when both ends plug into M12 ports, such as a sensor connected to an I/O block or junction box. Double-ended cordsets also include M12 to M8 and M12 to RJ45 versions.
Can I make an M12 cable to a custom length?
Yes. Field wireable M12 connectors terminate onto your own cable with screw, push-in, or IDC contacts, so you can cut the run to the exact length you need. Match the connector's coding, pin count, and cable diameter range to the cable you plan to use. Molded cordsets remain the better choice where washdown, vibration, or sealing is critical.
Do I need a male or female M12 cordset for my sensor?
Choose the gender opposite to the device port. Most sensors and actuators have a male M12 port, so the cordset end that plugs into the device is female. I/O blocks and junction boxes usually have female ports, so the cordset end that plugs into them is male.
Need help matching an M12 cordset to your device?
Send us the device part number and the run length, and the Automation Distribution team will help you confirm coding, pin count, gender, and jacket. Contact Automation Distribution or call 1-888-600-3080.