Skip to content

ISO 9001 Certified Manufacturer of Test Leads, Wire Harness, and Cable Assembly

Premium Custom Cable Assemblies & Wire Harnesses Manufactured in Taiwan.

Email: Sales@TeleWireTech.com , Phone: +1-682-747-6690

Precision Taiwan-Made Wire Harness & Cable Assemblies

Submit your application details, drawings, and estimated quantities for a technical review and response within 24 hours.

Start Engineering Review

M12 Connector Pinout Reference: 4-Pin, 5-Pin and 8-Pin Assignments

M12 coding decides what can physically mate and what the interface can carry, and four rules govern it:

Key Takeaways

  • M12 coding is a mechanical keyway, not just a pin count — incompatibly coded connectors physically cannot mate, which is the entire point of the system.
  • On A-coded sensor cordsets following IEC 60947-5-2, pin 1 is brown (+24 V DC), pin 3 is blue (0 V) and pin 4 is black, the primary switching output.
  • No single standard covers M12: IEC 61076-2-101 defines A, B, C, D and P coding, while X-coding sits in IEC 61076-2-109 for data up to 500 MHz.
  • D-coded M12 is capped at 100 Mb/s because it carries only two pairs; X-coded uses eight pins as four shielded pairs to reach 10 Gb/s.
  • A 4-pin M12 supports PoE Type 1, but Type 2 and above require the 8-pin — pin count, not coding alone, sets the power ceiling.

Engineering rule of thumb: choose the coding from the signal and the standard that defines it, then confirm pin-to-wire mapping against the specific connector datasheet — coding fixes the keyway, not every manufacturer's internal wiring.

What M12 Coding Actually Does

Coding is a keyway. Each letter describes a different profile on the mating faces so that a connector carrying 600 V AC cannot be screwed into a socket expecting a 24 V sensor loop. The thread is always 12 mm, so without coding every M12 would mate with every other one, and the first wiring error would be the last.

The common mistake is treating IEC 61076-2-101 as the M12 standard. It defines A, B, C, D and P coding only. Data coding lives in IEC 61076-2-109 (X and H, for frequencies to 500 MHz), power coding in IEC 61076-2-111 (E, F, K, L, M, S and T), and hybrid power-plus-data in IEC 61076-2-113 (Y). M8 and M5 have their own parts, IEC 61076-2-104 and IEC 61076-2-105. Choosing between sizes and codings in the first place is covered in our M12 and M8 connector selection guide.

One mechanical detail catches people out: cable-end connectors have freely rotating threads while panel-mount connectors have fixed threads, regardless of gender. Two cable ends can therefore be joined, but two panel-mount connectors cannot be mated at all.

A-Coded Pin Assignments and Wire Colours

A-coding is the workhorse — sensors, actuators, DC power, CANopen, DeviceNet and Profibus PA, in pin counts from 2 up to 17. For the 3-, 4- and 5-pin variants that dominate factory floors, the wire colours are standardised by IEC 60947-5-2, which is what makes cordsets interchangeable between brands.

Pin 1 (brown) carries +24 V DC and pin 3 (blue) is 0 V, so those two form the supply pair on every variant. Pin 4 (black) is the primary switching output, which is why a 3-wire PNP or NPN proximity sensor uses pins 1, 3 and 4 and leaves pin 2 unpopulated. The 4-pin adds pin 2 (white) as a second output or digital input, and the 5-pin adds pin 5 (grey, or green/yellow on power layouts) as functional earth or a shield drain.

Reversing brown and blue is the failure that destroys hardware rather than merely interrupting it, since it applies reverse polarity directly to the sensor's output stage. That risk is why pin-to-wire mapping belongs on the build print for any I/O and control cable assembly, not just in the installer's memory.

Reading the Mating Face: Male and Female Numbering Mirror

Pin numbering on an M12 is not absolute — it is read from the mating face, and the two genders run in opposite directions. Male pin numbering runs clockwise around the centre; female contact numbering runs counter-clockwise, so that the two form a mirrored match when screwed together.

This matters when you are reading a drawing rather than holding the part. A pinout diagram is only usable once you know whether it depicts the plug or the socket, and a diagram copied from the wrong gender produces a cordset that is wired backwards while still passing a continuity buzz test on the wrong pins. Always confirm which face the drawing shows before releasing a build print.

The Ethernet Codings: Why D Stops at 100 Mb/s and X Reaches 10 Gb/s

D-coding is a 4-pin interface for industrial Ethernet — Profinet and EtherNet/IP — and it is limited to 100BASE-TX at 100 Mb/s for a structural reason, not a marketing one: four pins carry only two differential pairs, and 1000BASE-T and faster need all four pairs. No amount of better cable raises that ceiling.

X-coding solves it with eight pins arranged as four differential pairs behind an internal cross-shaped metal shield, which separates the pairs into quadrants and holds near-end crosstalk down at frequencies to 500 MHz. Paired with Cat 6A cable, that supports 10GBASE-T. A-coded 8-pin, meanwhile, will carry Gigabit Ethernet but without X-coding's pair shielding.

Power over Ethernet follows pin count rather than coding alone: a 4-pin M12 handles PoE Type 1, while Type 2 and above require the 8-pin. For the Ethernet codings, take the pin-to-pair assignment from the connector datasheet or from IEC 61076-2-109 and verify it against the specific part — pair ordering is not something to infer from a diagram found online. Factory-floor runs are usually specified as a sealed industrial cable assembly rather than field-terminated.

Shielding, Overmolding and Sealing M12 Cordsets

An M12 interface is only as good as the transition behind it. Overmolded PUR or PVC encapsulates the cable-to-connector joint, which provides strain relief and keeps cutting oils and washdown water out of the termination — the reason a factory-sealed custom cable assembly outperforms a field-wireable connector on vibrating machinery.

On shielded codings the shield has to be terminated through 360°, not pigtailed to one pin, or the connector stops containing the fields it was designed to contain. Sealing is specified to IEC 60529: IP67 for immersion, IP68 where continuous submersion applies. Both ratings depend on the gland matching the actual cable outside diameter, which is why a sealed IP67 cable assembly is quoted against a specific cable, not a nominal size.

M12 Coding Reference: Standards, Pin Counts and Ratings

Coding Defining Standard Typical Pin Counts Current / Voltage Rating Typical Use
A IEC 61076-2-101 2–17 4 A / 250 V ac-dc (2–4 pin); 2 A / 60 V (5 pin) Sensors, actuators, DC power, CANopen, DeviceNet, Profibus PA; Gigabit Ethernet on 8-pin
B IEC 61076-2-101 5 2 A / 60 V ac-dc Non-Ethernet fieldbus, commonly Profibus DP
C IEC 61076-2-101 3–6 Per manufacturer datasheet AC power, including motor connections
D IEC 61076-2-101 4 4 A / 250 V ac-dc Industrial Ethernet to 100 Mb/s — Profinet, EtherNet/IP
X IEC 61076-2-109 8 Per manufacturer datasheet Ethernet to 10 Gb/s with Cat 6A cable
Y IEC 61076-2-113 8 Per manufacturer datasheet Power combined with 100 Mb/s Ethernet
K IEC 61076-2-111 2–4 + PE 16 A / 600 V ac AC power, single-phase and three-phase
L IEC 61076-2-111 2–4 (+ FE) 12–16 A / 63 V dc DC power
S IEC 61076-2-111 2–3 + PE 12 A / 300–600 V ac AC power, replacing C-coding on new designs
T IEC 61076-2-111 2–4 12 A / 60 V dc DC power

A-Coded M12 Pin Assignments and Wire Colours

Pin Wire Colour (IEC 60947-5-2) Function 3-Pin 4-Pin 5-Pin
1 Brown +24 V DC supply (L+) Yes Yes Yes
2 White Second output or digital input No Yes Yes
3 Blue 0 V supply return (L−) Yes Yes Yes
4 Black Primary switching output Yes Yes Yes
5 Grey (or green/yellow) Functional earth or shield drain No No Yes

Specification FAQ

What do the brown, white, blue and black wires mean on an M12 sensor cable?

Brown is +24 V DC on pin 1, blue is 0 V on pin 3, black is the primary switching output on pin 4, and white on pin 2 is a second output or digital input. These assignments come from IEC 60947-5-2, which is what lets cordsets from different manufacturers be swapped. Reversing brown and blue applies reverse polarity to the sensor's output stage and can destroy it.

Can I plug a D-coded cordset into an A-coded socket?

No — the keyways are deliberately incompatible and will not mate. That is the purpose of coding: it makes an electrically dangerous or network-breaking connection mechanically impossible rather than relying on labelling. If a cordset will not thread into a socket, check the coding before applying force.

Why is D-coded M12 limited to 100 Mb/s?

Because four pins carry only two differential pairs, and 1000BASE-T and faster require all four pairs. The limit is structural, so upgrading to better cable does not raise it. Moving past 100 Mb/s means moving to X-coded 8-pin, or A-coded 8-pin for Gigabit without the pair shielding.

Does M12 support Power over Ethernet?

Yes, but pin count sets the ceiling: a 4-pin M12 supports PoE Type 1, while Type 2 and above require the 8-pin. Treat the coding and the pin count as two separate decisions, because a correctly coded connector with too few pins still will not carry the power class you need.

What MOQ and lead time apply to custom M12 cordsets?

Custom overmolded M12 cordsets are built to order from a minimum of 50 pieces, with samples available first for fit and continuity verification. What is needed to quote is the coding, pin count, cable type and length, shielding, and the IP rating the assembly has to hold. Supplying the mating part number or a drawing of the mating face removes the most common source of error.


An M12 specification is complete when four things are fixed: the coding and the IEC part that defines it, the pin count, the pin-to-wire mapping taken from the actual connector datasheet, and the sealing and shielding the environment demands. Confirm whether a pinout drawing shows the plug or the socket before releasing it to build — the two genders number in opposite directions, and that single check prevents a batch wired backwards.

Need M12 Cordsets Built to Your Pinout?

We build overmolded M12 cable assemblies in A-, D- and X-coding to IP67, shielded or unshielded, with your pin-to-wire mapping documented on the build print and verified by continuity test before shipment. Samples available for fit checks.

Michael Wang - Senior Technical Engineer

About the Author

Michael Wang

Senior Technical Engineer

As the technical lead at TeleWire, Michael bridges the critical gap between complex engineering requirements and precision manufacturing. With deep expertise in Design for Manufacturing (DFM) and signal integrity, he oversees the technical validation of custom interconnect solutions for mission-critical automotive, industrial, and medical applications.

Back to blog

Custom Cable & Wire Harness Assembly Solutions

Have a drawing or a BOM? Fill out the form. Our engineers review every submission to ensure manufacturability and provide a quick quote.

Engineering review within 24 hours
No Minimum Order Quantity (MOQ) for prototypes
ISO 9001:2015 Compliant Assembly
100% Electrically Tested
Material Certifications (RoHS/REACH) Available
Unlimited Customization Options
Cost-Efficient Scaling to Production
Premium Quality: Made in Taiwan

Request a Quote

We reply within 24 hours. No account needed. Your specifications stay confidential; NDA available on request.

Manufacturing Standards & Capabilities

ISO 9001 Certified Factory

TeleWire Technology operates under strict ISO 9001 Quality Management Systems. Every production run undergoes rigorous IQC (Incoming Quality Control) and IPQC (In-Process Quality Control) to ensure consistent, OEM-grade reliability for global supply chains.

IPC/WHMA-A-620 Compliance

Our assembly technicians adhere to IPC/WHMA-A-620 standards for cable and wire harness fabrication. We guarantee precision crimp height, pull-force retention, and strain relief integrity for high-vibration automotive and industrial environments.

100% Electrical Testing

Zero defect policy. 100% of finished assemblies undergo automated testing for continuity, shorts, and mis-wiring. For critical safety applications, we provide advanced VSWR testing, high-pot testing, and insertion force validation.

Custom Component Sourcing

We source genuine connectors from Amphenol, TE Connectivity, Molex, and JST, or provide cost-effective, high-quality equivalents to meet your BOM targets. Our engineering team supports rapid prototyping with low MOQs and fast turnaround times.

Have 2D or 3D drawings ready?

Talk to our engineering team for immediate design validation and DFM (Design for Manufacturing) support.

Request Technical Quote →