M12 Connector Coding Explained: A, B, D & X-Coded

Connector Reference

M12 Connector Coding Explained: A, B, D, and X-Coded

M12 connector coding tells you which cordset works with sensors, power, fieldbus, or Ethernet. Matching the keyway prevents a mis-matched connection and, just as important, prevents you from putting network data or power on the wrong pins.

Live-person support during business hours Expert picks
Coding stops mismatingEach keyway physically blocks the wrong cordset from seating.
Match signal typeA-coded for sensors/power, D-coded for Cat5e Ethernet.
Pin count matters2, 3, 4, or 5 pole inserts for your device.
IP-rated for wetIP68/IP69 jackets survive washdown and oil when torqued fully.
Quick answer

M12 connector coding is the keyway shape that decides what a connector mates with: A-coded for sensors, actuators and DC power; B-coded for PROFIBUS/fieldbus; D-coded for 100 Mbit Ethernet; X-coded for Gigabit Ethernet. All M12 share the same M12 x 1 thread, so coding, not thread size, is what determines mating. Match the code to your device first (the keys physically block a mismated connection), then pick pin count, wire gauge, and length.

Which One Should You Buy?

Find the row that matches your setup from our recommended picks:

Your situationOur pickWhy
Two-wire DC load or simple actuator on a machine Mencom MDC-2FP-2M M12 Cordset, 2 Pole, Female Straight, 2 MeterMDC-2FP-2M 2-pole A-coded, 20 AWG on pins 3 and 4, 2 m
Three-wire PNP/NPN proximity or photo sensor Mencom MDC-3FP-2M M12 Cordset, 3 Pole, Female Straight, 2 MMDC-3FP-2M 3-pole A-coded, 22 AWG, standard sensor wiring, 2 m
Three-wire sensor on a long run needing lower voltage drop Mencom MDC-3FPX-2M M12 Cordset, 3 Pole, Female Straight, 18 AWG, 2 MMDC-3FPX-2M 3-pole A-coded with heavier 18 AWG conductors, 2 m
Four-wire sensor or dual-output device, far from panel Mencom MDC-4FP-10M M12 Cordset, 4 Pole, Female Straight, 10 MMDC-4FP-10M 4-pole A-coded, 22 AWG, 10 m reach
EtherNet/IP or PROFINET drop between switch and device Lumberg Automation 0985 806 127/10M Ethernet M12 Cordset, Male Right Angle / Female Straight, 4 Pin, 10 M900004221 D-coded Cat5e M12 extension, right-angle to straight, 10 m

How to Choose

Start with what the device expects. If it's a discrete sensor, actuator, or DC power point, you want an A-coded M12 with a single keyway (every Mencom MDC series connector is A-coded). Choose pin count by function: the MDC-2FP-2M (2 pole, 20 AWG) is for simple two-wire loads on pins 3 and 4; the MDC-3FP-2M (3 pole, 22 AWG) suits three-wire PNP/NPN sensors; the MDC-4FP-10M (4 pole, 22 AWG) covers four-wire sensors or dual-output devices at a longer 10 m reach. Need lower voltage drop on a longer three-wire run? Step up to the MDC-3FPX-2M with heavier 18 AWG conductors. All four carry the same 300 V rating and a 4 A per-contact rating (derate at elevated ambient; the 4 A figure assumes moderate temperature), with an IP69 yellow PVC jacket. For Industrial Ethernet (EtherNet/IP or PROFINET at 100 Mbit) coding changes entirely: use the D-coded Lumberg 900004221, a Cat5e bonded twisted-pair extension. Never try to force a D-coded plug into an A-coded socket; the keyways won't allow it, and forcing it damages both inserts.

Our Recommended Products

Below are A-coded sensor/power cordsets in 2, 3, and 4 pole, plus a D-coded Ethernet extension. Pick by coding first, then pin count, gauge, and length.

Mencom MDC-2FP-2M M12 Cordset, 2 Pole, Female Straight, 2 Meter

Mencom MDC-2FP-2M M12 Cordset, 2 Pole, Female Straight, 2 Meter

Product Code: MDC-2FP-2M
Best for: Two-wire DC loads and simple actuators, short run
View Current Price
View Product
Mencom MDC-3FP-2M M12 Cordset, 3 Pole, Female Straight, 2 M

Mencom MDC-3FP-2M M12 Cordset, 3 Pole, Female Straight, 2 M

Product Code: MDC-3FP-2M
Best for: Standard three-wire PNP/NPN sensors, 2 m
View Current Price
View Product
Mencom MDC-4FP-10M M12 Cordset, 4 Pole, Female Straight, 10 M

Mencom MDC-4FP-10M M12 Cordset, 4 Pole, Female Straight, 10 M

Product Code: MDC-4FP-10M
Best for: Four-wire sensors or dual-output devices needing 10 m reach
View Current Price
View Product
Mencom MDC-3FPX-2M M12 Cordset, 3 Pole, Female Straight, 18 AWG, 2 M

Mencom MDC-3FPX-2M M12 Cordset, 3 Pole, Female Straight, 18 AWG, 2 M

Product Code: MDC-3FPX-2M
Best for: Three-wire sensors on longer runs, heavier 18 AWG for lower drop
View Current Price
View Product
Lumberg Automation 0985 806 127/10M Ethernet M12 Cordset, Male Right Angle / Female Straight, 4 Pin, 10 M

Lumberg Automation 0985 806 127/10M Ethernet M12 Cordset, Male Right Angle / Female Straight, 4 Pin, 10 M

Product Code: 900004221
Best for: EtherNet/IP or PROFINET drops at 100 Mbit, D-coded Cat5e, IP68
View Current Price
View Product

What A, B, D, and X coding actually means

M12 coding refers to the shape of the plastic insert and keyway inside the connector. It exists so you cannot accidentally plug a power cordset into a network port. The four codes you'll meet most:

  • A-coded: sensors, actuators, and DC power. Available in 2, 3, 4, 5, and 8 pole. Single keyway. All Mencom MDC cordsets here are A-coded.
  • B-coded: fieldbus signaling, most commonly PROFIBUS DP.
  • D-coded: 100 Mbit (Fast) Ethernet, 4-pin, Cat5e. The Lumberg 900004221 is D-coded.
  • X-coded: Gigabit Ethernet, 8-pin, Cat6a, up to 10 Gbit.

The keys are mechanical. An A-coded plug physically will not seat in a D-coded socket. Every M12 shares the same M12 x 1 thread, so you cannot tell coding from the thread; identify your device's coding from its datasheet or the insert profile, then match the cordset.

How to choose M12 pin count for sensors and power

Once you've confirmed A-coding, pin count follows the wiring of your device:

  • 2 pole: two-wire loads. The MDC-2FP-2M lands on pins 3 (brown) and 4 (blue), 20 AWG.
  • 3 pole: three-wire PNP/NPN sensors. The MDC-3FP-2M wires pin 1 brown, pin 3 blue, pin 4 black, 22 AWG.
  • 4 pole: four-wire sensors or dual-output devices. The MDC-4FP-10M wires pin 1 brown, pin 2 white, pin 3 blue, pin 4 black, 22 AWG.

Gauge matters on long runs. Voltage drop climbs with cable length and current and shrinks with larger wire, so for a three-wire sensor on a longer run, the MDC-3FPX-2M steps up to 18 AWG. Note the trade-off: heavier conductors mean a larger cable O.D. (0.29 in vs 0.20 in) and a stiffer bend, so allow room at the connector. Match the pinout in your sensor datasheet to the cordset's wiring color assignment before you order. A physical fit does not guarantee correct wiring.

D-coded M12 Ethernet cordset wiring and use

D-coded M12 is the workhorse connector for machine-level EtherNet/IP and PROFINET at 100 Mbit. It uses 4 pins on two bonded twisted pairs. The Lumberg 900004221 wires pin 1 white/orange, pin 2 white/green, pin 3 orange, pin 4 green (the standard Fast Ethernet pinout) over a teal TPE Cat5e cable, 24 AWG stranded tinned copper.

This particular cordset is an extension: M12 male right-angle on one end, M12 female straight on the other, 10 meters, IP68. Use it to run a drop from an M12-ported switch or I/O block to a device without hand-terminating field connectors. Keep the run within the 100 m Ethernet channel limit including patch leads, and maintain shield/ground continuity per your network design to avoid noise on the pair. If your network is specified for Gigabit, you need an X-coded (8-pin) cordset instead. D-coded tops out at 100 Mbit.

How to identify and mate M12 coding correctly

Work in this order every time:

  • Read the device datasheet for the connector coding and pinout. Don't guess from the thread, which is M12 x 1 on all codes.
  • Confirm pin count and gender. A cordset's female end mates with a male device port and vice versa.
  • Check the keyway visually: A-coded has one wide key, D-coded has a distinct cross/D profile, X-coded shows an X-shaped insert.
  • Match cable rating to the environment: IP69 yellow PVC for washdown and oil (Mencom MDC), IP68 TPE for flexing Ethernet runs (Lumberg). IP ratings only hold if the coupling nut is fully hand-tightened; a loose nut voids the seal.
  • Verify voltage and current headroom: 300 V / 4 A per contact on the Mencom sensor cordsets, 250 V / 4 A on the D-coded Ethernet extension. Derate current at high ambient temperature.
  • For classified/hazardous areas, use a connector specifically approved for that classification. These cordsets are general-purpose, not explosion-rated.

Never force a connector. If it won't thread with light hand pressure, the coding or gender is wrong.

M12 coding at a glance

CodeTypical usePinsData / rating
A-codedSensors, actuators, DC power2/3/4/5/8Up to ~4 A per contact; single keyway
B-codedPROFIBUS / fieldbus5Fieldbus signaling
D-codedFast Ethernet (EtherNet/IP, PROFINET)4100 Mbit, Cat5e
X-codedGigabit Ethernet8Up to 10 Gbit, Cat6a

Common Mistakes (and the Fix)

✗ Ordering by thread size, assuming all M12 are the same
✓ All M12 share M12 x 1 threads. Check the coding and keyway, which is what actually determines mating.
✗ Using an A-coded cordset for an Industrial Ethernet drop
✓ Use a D-coded (100 Mbit) or X-coded (Gigabit) Ethernet cordset with the correct twisted-pair pinout and shielding.
✗ Picking the wrong pin count for a three- or four-wire sensor
✓ Count the active wires on the device datasheet and match 2, 3, or 4 pole accordingly.
✗ Running thin 22 AWG on a long sensor run and getting voltage drop
✓ Step to the 18 AWG MDC-3FPX cordset for lower drop on longer or higher-current circuits.
✗ Specifying a D-coded cordset for a Gigabit network
✓ D-coded is 100 Mbit only; use an 8-pin X-coded connector for Gigabit.
✗ Leaving the coupling nut loose and losing the IP seal
✓ Hand-tighten the coupling nut fully. IP68/IP69 ratings only hold when the nut is seated.
✗ Assuming a washdown-rated cordset is safe in a classified area
✓ IP69 is not hazardous-location rated. Use a Class/Division or ATEX/IECEx approved connector where required.

Frequently Asked Questions

What is the difference between A, B, D, and X-coded M12 connectors?

Coding is the keyway pattern in the insert that determines what a connector mates with. A-coded handles sensors, actuators, and DC power. B-coded is for fieldbus signaling, most commonly PROFIBUS. D-coded carries 100 Mbit Fast Ethernet (Cat5e). X-coded carries Gigabit Ethernet (Cat6/Cat6a). The keys physically prevent plugging one coding into another. The thread (M12 x 1) is identical across all of them, so coding is what actually matters.

Can I use an A-coded M12 cordset for Ethernet?

No. Industrial Ethernet needs a D-coded (100 Mbit) or X-coded (Gigabit) connector with the correct twisted-pair pinout and shielding. The A-coded Mencom MDC cordsets here are built for sensor and DC power circuits, not network data — the pinout and cable construction are wrong for Ethernet. Use the D-coded Lumberg 900004221 for EtherNet/IP or PROFINET.

How do I know if my sensor needs 3-pin or 4-pin M12?

Count the active wires on the sensor. A two-wire loop uses 2-pole, a three-wire PNP/NPN sensor uses 3-pole, and a four-wire or dual-output device uses 4-pole. Always confirm against the sensor datasheet's connection diagram, and match the brown/blue/black/white color-to-pin assignment before ordering.

Which M12 code is D-coded and which is X-coded?

D-coded is a 4-pin Ethernet connector rated for Cat5e / 100 Mbit, like the Lumberg 900004221 here. X-coded is an 8-pin connector rated for Cat6a and up to 10 Gbit. If your device only lists Fast Ethernet, D-coded is correct; if it lists Gigabit, you need X-coded.

What does the single keyway on the Mencom MDC cordsets mean?

The single keyway is the A-coding feature. It aligns with the notch on A-coded devices so the connector seats and threads correctly, and it blocks D-coded or B-coded mates. It's the standard keying for sensor and DC power M12 connectors.

Is a 3-pin or 4-pin M12 cordset compatible with Turck or Brad Harrison connectors?

M12 is an international standard, so the MDC-3FP-2M and MDC-4FP-10M can be compatible with certain Turck Microfast M12 connectors and Brad Harrison/Molex parts (120065-0129 and 120065-0277 are cross-referenced). Compatibility depends on matching coding, pin count, and pinout. Always confirm those against the device datasheet before mating, since a physical fit does not guarantee a correct wiring match.

What are the voltage and current ratings on these M12 cordsets?

The Mencom MDC A-coded cordsets are rated 300 V and 4 A per contact, with gold-plated copper alloy contacts and IP69 yellow PVC. The D-coded Lumberg Ethernet cordset is rated 250 V, 4 A, IP68, Cat5e. The 4 A current rating assumes moderate ambient temperature. Derate at higher temperatures and never exceed the rated voltage or current.

Are these M12 cordsets rated for hazardous locations?

The listed ratings cover UL/CUL general-purpose use and IP68/IP69 ingress protection, not hazardous-location (Class/Division or ATEX/IECEx) service. If your application is a classified area, use a connector specifically approved for that classification and follow the applicable code. Do not assume a washdown-rated cordset is explosion-rated.

Terms Worth Knowing

Coding (keying)
The insert/keyway shape that determines which connectors mate: A, B, D, X, and others prevent mismating.
A-coded
Single-keyway M12 for sensors, actuators, and DC power in 2 to 8 pole configurations.
D-coded
4-pin M12 for 100 Mbit Fast Ethernet such as EtherNet/IP and PROFINET, Cat5e-rated.
X-coded
8-pin M12 for Gigabit Ethernet, Cat6a-rated, up to 10 Gbit.
Cordset
A factory-molded cable with a connector on one or both ends (plug and play, no field wiring).
IP69
Ingress rating for total dust protection plus high-pressure, high-temperature washdown jets.
IP68
Ingress rating for total dust protection plus continuous immersion under conditions set by the manufacturer.
Pinout
The wire-color-to-pin assignment (e.g. pin 1 brown, pin 3 blue) that must match the device.
Voltage drop
The loss in voltage over cable length; it rises with distance and current and falls with larger wire gauge.