
If you are looking up an M12 connector pinout, the pin number is only one part of the answer. A 4-pin A-coded sensor port and a 4-pin D-coded Ethernet port have the same contact count, yet they carry different types of circuits and use different keying. The drawing also needs a clear viewing direction, a defined connector gender, a matching cable and enough space for mating and removal. Wire colors can support identification, but they cannot replace the equipment drawing.
At Soulin, we use a pinout record that follows the connection from the equipment interface to the finished cable. It covers the code, pin count, contact function, rating, shielding, cable route and installed condition. The twelve checks below turn a pinout chart into a practical selection and wiring method.
| Equipment need | Common starting point | Confirm in the selected drawing |
|---|---|---|
| Sensors, actuators and general I/O | A-coded | Supply, return, device signals, logic and pin assignment |
| PROFIBUS-style fieldbus | B-coded | Signal assignment, network standard and shield path |
| 100 Mbps industrial Ethernet | D-coded | Differential-pair routing, polarity, cable category, shielding and complete channel |
| Gigabit or higher-speed industrial Ethernet | X-coded | Four pair assignments, shielding, termination and network hardware |
| DC power | T-coded or L-coded | Voltage, current per contact, conductor size and temperature limits |
| AC power | S-coded or K-coded | Applicable power standard, earth arrangement and spacing |
| Combined power and data | Y-coded | Separate power and data maps, ratings and shield paths |
What an M12 Connector Pinout Tells You—and What It Does Not
Check 1: Document hierarchy and pinout record
Pin count, coding, pinout and wiring diagram describe different things. Pin count states how many contacts are present. Connector coding identifies the mechanical keying and the application family. The pinout assigns an electrical function to each numbered contact. A wiring diagram shows how that connector is connected to a sensor, controller, cable assembly or PCB.
Wire color belongs to a particular cable. Brown, white, blue and black are common in A-coded sensor cables, while higher-contact cable assemblies can follow a product-specific color sequence. Two cables with different colors can still have the same contact assignment, and two cables with similar colors can serve different devices. The equipment manual or approved equipment drawing therefore takes priority, followed by the connector drawing and the cable-assembly table.
A useful pinout record contains the connector code, pin count, male or female interface, viewing direction, equipment model, signal at every contact, electrical rating, cable type, shield path and unused contacts. Recording those fields keeps the drawing, sample and production cable aligned.
How to Read Male, Female and Panel-Mount Pinout Drawings
Check 2: Fixed keyway as the drawing datum
The keyway gives the pin-face drawing a fixed starting point. A view with the keyway at 12 o’clock lets the reader relate the contact positions to the equipment. The thread alone is not enough: A-, B-, D-, X-, S-, T-, L- and K-coded interfaces use the M12 form for different applications, while a connector with a 12 mm thread may belong to another interface family.
Check 3: Viewing direction
Every pinout is tied to a viewpoint. A mating-face view looks toward the contacts from the connection side. A wiring-side view looks at solder cups, screw terminals, PCB tails or cable conductors from behind. Treating one view as the other shifts the contact positions even when the connector itself is correct.
Board-mounted parts create a related risk. A PCB footprint is commonly read from the component side, while a board-end connector may be shown from its mating face. The keyway, the board side and the connector drawing need to be read together before the footprint is released.
Check 4: Gender and panel orientation
Pins form a male interface and sockets form a female interface. A panel body, coupling nut or external thread does not identify gender on its own. A panel drawing also needs the outward-facing side, rear termination, locknut position and the direction from which the connector will be serviced.
Common M12 Pinout Patterns: 4-Pin, 5-Pin and 8-Pin
Check 5: 4-pin A-coded M12 sensor pinout
In one common—but not universal—sensor reference:
- Pin 1 — brown — L+ or positive supply
- Pin 2 — white — device-defined input or switching function
- Pin 3 — blue — L− or 0 V
- Pin 4 — black — device-defined output or switching function
Pins 1 and 3 are stable in many three- and four-wire sensor arrangements. Pins 2 and 4 are more application-specific. One sensor may use pin 4 as its main output and leave pin 2 open; another may use both switching contacts; an IO-Link device can use pin 4 as its communication line. PNP or NPN logic also belongs to the device specification. When a cable color and the sensor manual disagree, the sensor manual controls the connection.
Check 6: 5-pin A-coded M12 and the fifth contact
Pin 5 deserves its own entry in the pinout record. A five-position A-coded cable often uses the color sequence shown below, but conductor color is a cable convention rather than a universal function.
| Pin | Common cable color | Reference sensor function | IO-Link Class B only |
|---|---|---|---|
| 1 | Brown | L+ or positive supply | L+ / Power 1 |
| 2 | White | Device-defined input or output | P24 (+) / auxiliary Power 2 |
| 3 | Blue | L− or 0 V | L− / Power 1 |
| 4 | Black | C/Q, switching output or another device signal | C/Q |
| 5 | Gray | Device-defined contact; shield or drain, functional earth, auxiliary circuit or NC | N24 (−) / auxiliary Power 2 |
Use this table as a reference only. The equipment drawing and cable drawing must state whether pin 5 is a signal, shield or drain connection, functional earth, auxiliary return or no connection. IO-Link Class B is a specific application in which pins 2 and 5 provide the auxiliary supply pair.
4-pin D-coded M12 Ethernet pinout
The 4-pin D-coded connector has the same contact count as the A-coded sensor example, but it serves a different circuit. D-coding is commonly used for 100 Mbps industrial Ethernet over two differential pairs: pins 1 and 3 form one pair, while pins 2 and 4 form the other. The actual link rate still depends on the cable, termination, connected equipment and complete channel. The connector is not a sensor power-and-switching interface, so a pin-for-pin substitution can leave the network link unusable. An M12-to-RJ45 cable also needs the correct pair mapping; copying contact numbers without preserving each pair splits the Ethernet channel.
Example: From an Equipment Drawing to a Finished Cable
Suppose an equipment drawing identifies a five-position A-coded sensor port and assigns pin 1 to L+, pin 2 to a device-defined input, pin 3 to L−, pin 4 to C/Q, and pin 5 to no connection. The cable drawing should repeat the pin numbers, identify the mating connector, state the viewing direction, and assign conductor colors for the selected cable. The assembly record then adds the sensor model, cable length and outer diameter, connector orientation, shield termination if required, and drawing revision. Before release, verify point-to-point continuity, confirm that pin 5 remains isolated, check insulation between conductors and the approved shell or shield path, inspect contact seating and strain relief, and record the result against the approved revision. If the port is specified as IO-Link Class B instead, pins 2 and 5 become the auxiliary supply pair, so the cable schedule and test map must change with the equipment drawing.
8-pin X-coded M12 Ethernet pinout
A typical X-coded Ethernet assembly uses eight contacts as four differential pairs. A common reference map is:
Pins 1–2: D1+ / D1− Pins 3–4: D2+ / D2− Pins 5–6: D4+ / D4− Pins 7–8: D3− / D3+
Confirm the view direction, polarity notation, cable termination and shield path on the selected equipment and cable drawings. The connector is one part of the transmission system. The cable, pair termination, shield continuity and network hardware must support the intended channel, so an X-coded connector by itself does not guarantee a data rate.
The practical question changes with each code. A-coded interfaces center on supply, return and device signals. D-coded interfaces center on differential-pair assignment and shield continuity. X-coded interfaces add four-pair order, shielding, termination and the performance of the complete channel.
Electrical Rating and the Complete Signal or Data Channel
Check 7: Product-specific electrical rating
The label “M12” does not establish one voltage or current rating. The SW15T front-lock connector is rated at 60 V for 2–5-pin versions and 30 V for 6–17-pin versions. Its current rating is 4 A for 2–5-pin versions, 2 A for 6–8-pin versions and 1.5 A for 9–17-pin versions. Those figures belong to the listed configuration and cannot be applied to another coding, body or pin count.
The same point appears in data and power examples. The8-pin X-coded molded female connector is listed at 48 V and 0.5 A, while the SW17T L-coded panel-mount product is published at 60 V and 4 A.
Check 8: Complete channel and shield path
An Ethernet pin map covers only the contact assignment. Port speed, cable category, termination and the opposite-end connector complete the channel. Shielded construction helps when the cable shield is bonded to the connector body and the equipment provides the intended grounding path. A discontinuity at an adapter, drain wire or cable transition can affect a link that looks correct on paper.
From a Correct Pinout to a Connector That Fits the Equipment
Check 9: Construction matched to the equipment constraint

Once the contact map is known, match the connector construction to the equipment constraint:
- Repeat production — molded cable assembly — fix the cable length, pinout and opposite end on the drawing
- Field repair — field-wireable connector — define the termination and sealing method
- Enclosure interface — panel-mount or bulkhead connector — confirm the cutout, panel thickness and rear clearance
- Limited cabinet depth — right-angle or short-body construction — check the outlet direction and installed envelope
- Limited internal tool access — front-lock structure — confirm external fastening access
- Protected exterior hardware — rear-lock structure — confirm internal locknut access
- Water, oil or vibration at the rear — potted construction — confirm cable-exit sealing and strain relief
The Y-CJ 2–8-pin front-lock panel-mount connector keeps screw tightening outside the enclosure, which suits a populated PCB or a cabinet with limited rear access. A rear-lock panel connector takes the opposite approach and places the locking operation inside the equipment. Neither structure is inherently better; the panel section and service direction decide which one fits. Y-coded refers to the connector coding; Y-CJ is our front-lock product series.
Check 10: Installed envelope and cable outlet
An electrically correct connector can still fail in the finished machine if the plug cannot be aligned, tightened or removed. The installed envelope has three useful zones: the axial path for mating and withdrawal, the radial space around the coupling nut for fingers or a tool, and the cable transition from the overmold or gland to the first bend and support point.
Right-angle products add an orientation decision. Describe the cable outlet against the keyway datum, such as “viewed from the mating face, keyway at 12 o’clock, cable exits toward 3 o’clock.” The cable outer diameter must suit the gland and strain relief, while nearby boards, frames, covers and neighboring ports compete for the same space.
Panel cutout and body length also vary within the M12 family. The F-type panel-mount male connector uses a 22L extended-thread housing for different panel thicknesses, while the SW15T-19.3L front-lock panel-mount product uses a 19.3L body. Other panel products use a PG9 thread. The drawing needs to state the cutout, thread, panel thickness and rear clearance together.
Environmental and Sealing Conditions
Check 11: Complete sealing path
The mating face is only one part of the sealing path. A panel connector also relies on its panel gasket or O-ring, while the rear termination and cable entry have to prevent moisture from tracking along the conductors. An unused outdoor port may need a protective cap because a published IP condition can apply only when the connector is fully mated or capped.
The SW15T product information lists an IP67/IP68 rating and an EPDM O-ring for the specified construction. Other molded or potted products use their own seal, cable-exit and test conditions. Oil, chemicals, UV exposure, temperature, vibration and cable movement belong in the same selection discussion. IP67 or IP68 is a property of the stated configuration and installed condition, not a blanket property of every M12 connector.
Pre-Power Verification and M12 Pinout Troubleshooting
Check 12: Pre-power test record
The finished assembly record should contain:
- Approved drawing revision and connector identity
- Coding, keyway, gender and viewing direction
- Point-to-point continuity
- Contact-to-contact isolation
- Contact-to-shell isolation unless the approved design connects them
- Supply and return polarity
- Ethernet pair order at both ends
- Shield termination path from cable to connector and equipment
- Contact seating, strain relief and cable bend condition
- Gasket, potting and cable-entry condition
- Full mating and coupling-nut engagement
- Test results, date and traceability reference
Our production information includes continuity and insulation-resistance testing within the stated inspection workflow. The availability and format of any inspection report should be confirmed in the applicable product or project quality plan rather than assumed.
Troubleshooting table
| Symptom | Likely cause | What to review |
|---|---|---|
| Connector will not mate | Wrong coding or mating side | Keyway and part number |
| Device remains unpowered | Polarity, open circuit or wrong viewing direction | Device diagram and continuity |
| Sensor powers up but output is wrong | Pin 2 or pin 4 assignment mismatch | Exact sensor manual |
| Ethernet link fails or is unstable | Pair, cable or shield problem | Complete channel map |
| Fault appears during movement | Termination, strain relief or cable bend problem | Installed cable route |
| Moisture appears behind the panel | Gasket, panel seal or cable-entry problem | Complete sealing path |
What to Include in an OEM or Replacement Request
An effective RFQ package is easier to compare when it uses named fields:
- Equipment model and circuit function
- Mating-face drawing with coding, pin count and pin assignment
- Male or female interface and mating connector reference
- Voltage and current for each circuit
- Cable type, outer diameter, length, wire gauge and shielding
- Panel cutout, panel thickness and rear clearance
- Straight or right-angle body and cable-outlet clocking
- Environmental exposure and required IP condition
- Existing sample, part number or replacement reference
- BOM, target quantity, packaging and labeling
- Required continuity, insulation, mating or retention records
We can work from a drawing, sample or BOM when a replacement part or custom harness needs a different pin count, cable length, terminal, plating, housing, pinout or opposite connector. A configuration review at that stage gives the project team a defined part to test instead of an assumed substitute.
Frequently Asked Questions
Conclusion: Treat the Pinout as Part of the Interface
Reliable M12 wiring comes from aligning the contact map with the code, viewing direction, cable path, installed envelope and sealing construction. Once those facts are recorded, a connector can be selected or adapted with fewer surprises. A drawing, sample or BOM gives an application review enough information when the project needs a defined replacement, cable assembly or custom configuration.



