What Are M12 D-Coded Connectors Used For?
A four-pin M12 connector is not automatically a sensor connector. In industrial automation, a visually similar four-contact product…
You know you need an A-coded M12 connector. But which pinout should you use? A 3-pin sensor, a 4-pin switching sensor, and a 5-pin IO-Link device may all use the same M12 A-coded interface, but their wiring is not the same.
If the pin assignment is wrong, the sensor may not power on, the signal may not reach the PLC, or the device may be damaged. This guide explains the standard M12 A-coded 3-pin, 4-pin, and 5-pin pinout and wire color conventions used in industrial automation.
For most M12 A-coded sensor cables, pin 1 is brown for +24V DC, pin 3 is blue for 0V, and pin 4 is black for the main switching output or IO-Link C/Q line.
| Pin | 3-Pin A-Coded | 4-Pin A-Coded | 5-Pin A-Coded | Typical Wire Color |
|---|---|---|---|---|
| 1 | +24V DC | +24V DC | +24V DC | Brown |
| 2 | — | Second output / input | Second output / analog signal | White |
| 3 | 0V | 0V | 0V | Blue |
| 4 | Switching output | Primary switching output | Output / IO-Link C/Q | Black |
| 5 | — | — | FE / third output / analog ground | Grey |
This table gives the common reference, but the final wiring should always follow the device datasheet. Some sensors, IO-Link devices, and proprietary equipment may use pin 2 or pin 5 differently.

M12 A-coded connectors are widely used for industrial sensors and actuators. Their mechanical interface and coding are related to the IEC 61076-2-101 connector standard, but the actual signal assignment still depends on the device manufacturer.
Most industrial sensor manufacturers follow common pinout conventions, but not every product is wired the same way. For example, pin 2 may be a second output, an external input, an analog signal, or not connected at all. When in doubt, the device datasheet overrides any general pinout guide.
Before ordering or wiring an M12 A-coded connector, confirm these details:
A 3-pin M12 A-coded connector is commonly used for simple switching sensors that only need power, ground, and one output signal.

| Pin | Signal | Typical Wire Color |
|---|---|---|
| 1 | +24V DC supply voltage | Brown |
| 3 | 0V ground | Blue |
| 4 | Switching output, NO or NC | Black |
Notice that pin 2 is skipped. This is intentional. A 3-pin M12 A-coded connector normally uses pins 1, 3, and 4 so that it remains physically compatible with common M12 A-coded mating interfaces.
This configuration is often used for basic inductive proximity sensors, magnetic reed switches, and simple photoelectric sensors. The current draw is usually low, so the cable does not normally require a heavy conductor size. However, the final cable specification should still match the sensor current and installation environment.
A 4-pin M12 A-coded connector is one of the most common configurations in industrial automation. It adds pin 2 for a second output, input, or special function while keeping the same basic power and signal structure.

| Pin | Signal | Typical Wire Color |
|---|---|---|
| 1 | +24V DC supply voltage | Brown |
| 2 | Second output / input / not connected | White |
| 3 | 0V ground | Blue |
| 4 | Primary switching output, NO or NC | Black |
In a standard 4-pin PNP normally open sensor, pin 4 is the main switching output. When the sensor detects a target, pin 4 switches high, usually to +24V DC.
Pin 2 depends on the device. On some sensors it is a second output, such as light-on or dark-on output for a photoelectric sensor. On other devices it may be an input, such as a teach-in signal, or it may not be connected.
If you are selecting an M12 4-pin connector for a machine, control cabinet, or sensor cable, do not confirm the part only by pin count. You should also confirm whether you need a male or female connector, straight or angled body, molded cable, field wireable type, panel mount socket, or PCB mount connector.
A 5-pin M12 A-coded connector is commonly used for IO-Link devices and sensors that need more than one signal function through the same connector.

| Pin | Signal | Typical Wire Color |
|---|---|---|
| 1 | +24V DC supply voltage | Brown |
| 2 | Second output / analog output / auxiliary signal | White |
| 3 | 0V ground | Blue |
| 4 | Primary output / IO-Link communication C/Q | Black |
| 5 | Functional earth / analog ground / third output | Grey |
In IO-Link applications, pin 4 is normally used as the C/Q communication line between the sensor and the IO-Link master. Pin 2 may be unused, or it may be used as an additional digital or analog signal depending on the device design.
Pin 5 is also application-dependent. It may be functional earth, analog ground, or another signal line. Always check the IO-Link device documentation before wiring a 5-pin M12 connector.
If you replace a 4-pin sensor cable with a 5-pin cable, the connector may still physically fit because both are M12 A-coded. However, the available functions depend on the device, cable, and IO-Link master. A physically compatible connector does not always mean the wiring is electrically correct.
Male and female M12 connectors are easy to confuse because the pin positions appear mirrored when viewed from the mating face.

A male M12 connector has visible pins. A female M12 connector has sockets. When you look at the front face, the pin numbering position is not the same as the mating connector. This is one of the most common reasons for wiring mistakes during field assembly.
When assembling a field wireable M12 connector, do not guess the pin position from the opposite mating side. Check the printed numbering on the insert, the wiring diagram supplied with the connector, or the device manufacturer’s datasheet.
Most wiring problems happen because the connector is selected by appearance only. The same M12 size can have different pin counts, coding types, gender directions, and internal wiring.
If the device datasheet is missing or unclear, confirm the pinout step by step before connecting the sensor to a PLC or IO-Link master.
If you are not sure, send the connector photo, device model, datasheet, or wiring diagram to your supplier. A clear front-view photo of the connector face can help confirm the pin count, coding, and gender direction.
NITAI Electronics manufactures M12 A-coded connector products for industrial automation, sensor wiring, control cabinets, and OEM equipment projects.
We can support different M12 A-coded configurations, including:
If you already have a drawing, datasheet, sample, or target application, send it to us for checking. We can help confirm the connector type, pinout, cable structure, and suitable production option before quotation.
A four-pin M12 connector is not automatically a sensor connector. In industrial automation, a visually similar four-contact product…
M12 connectors are easy to recognize as a family but surprisingly easy to misidentify as a specific part.…
A customer asks for a “standard M12 pinout.” It sounds like a simple request, but a pin diagram…
NITAI manufactures terminal blocks, M8/M12 waterproof connectors and industrial distribution modules for global OEMs, distributors and automation customers.
Leave a Reply