
The M8 connector is a small, circular connector commonly used in sensors, actuators, compact I/O devices, servo devices, and small control boxes.
The key is to check the coding. For example, a 4-pin Type A M8 connector and a 4-pin Type D M8 connector may look similar, but they are designed for different purposes and signal types. Before purchasing, always confirm the coding, pin arrangement, IP protection rating, shielding, cable material, and locking mechanism.
The M8 connector is popular because modern machinery has limited wiring space, yet connections still need to be waterproof, dustproof, vibration-resistant, and resistant to electromagnetic interference. The M8 connector provides a compact and reliable solution for these harsh environments.
What Is an M8 Connector?
An M8 connector is a compact circular connector with an 8 mm locking size. You will see it on proximity sensors, photoelectric sensors, small actuators, field I/O blocks, test devices, and compact panels.
It helps to think of M8 as the smaller option next to M12. M12 gives you more room, more power options, and more network choices. M8 is the better fit when the device is small, the cable route is tight, or the panel does not have much space left.
The Code Matters More Than the Pin Count
The most common ordering problem is simple: someone sees “M8 4-pin” and assumes all 4-pin M8 parts are the same.
We explain this clearly in our M8 4-pin A-code vs D-code guide. A-coded M8 is normally used for sensor, actuator, I/O power, and signal wiring. D-coded M8 is used for industrial Ethernet, including networks such as PROFINET, EtherCAT, and EtherNet/IP.
- A-code is the usual choice for sensors, actuators, switches, compact I/O, and DC signal wiring.
- D-code belongs on industrial Ethernet and network sensor connections.
- B-code appears in some fieldbuses and older automation systems.
- P-code is more specific. Check the drawing before you quote or buy it.
| Code | Typical use | Suitable for Ethernet? | Common pinout / notes |
|---|---|---|---|
| A-code | Sensors, actuators, switches, compact I/O, and DC power or signal wiring. | Usually no. Use D-code for Ethernet. | Common 4-pin sensor wiring: 1 BN/L+, 3 BU/0 V, 4 BK/signal, 2 WH/second signal. Always confirm the device datasheet. |
| D-code | Industrial Ethernet for network sensors, compact I/O, and field devices. | Yes. | 4-pin data-pair layout for PROFINET, EtherCAT, and EtherNet/IP. Keep pair order and shielding matched, especially with RJ45 adapters. |
| B-code | Some fieldbus and older automation systems. | No for standard Ethernet. | Keying and pin assignment differ from A-code and D-code. Match the mating face and bus drawing. |
| P-code | Specialized network/power layouts, often where Ethernet data and power are combined. | Only when the system calls for that P-coded solution; not interchangeable with D-code. | Do not choose by pin count. Confirm the device drawing, voltage/current rating, and cable spec before quoting. |

M8 Pinout Basics for Selection
Pinout just means each pin has a job. One pin may carry L+, another may be 0 V, another may be signal output, and another may be data. If the pinout is wrong, the cable may fit the connector but the device will not work correctly.
For many A-coded 4-pin sensor cables, the usual color set is BN, WH, BU, and BK. Brown is often L+, blue is often 0 V, black is often the main signal, and white may be a second signal or another function. That is common enough to be useful, but not safe enough to guess from. The device datasheet still wins.
D-coded M8 is a different story. It is carrying data pairs, not a simple sensor signal. If that M8 cable adapts to RJ45, pair layout and shielding matter. A cable can pass a basic continuity check and still give you an unstable Ethernet link.
A Simple Selection Flow
You can start with the machine itself. What is the connector doing? Is it a sensor lead, a servo signal, a panel feedthrough, or an Ethernet link? Once that is clear, the rest gets much easier.
For a standard sensor, A-code is usually where you begin. For Ethernet, look at D-code. If the connector sits on a small enclosure, check whether the panel design needs front lock or rear lock. If the cable moves, strain relief and bend radius deserve more attention than the connector photo.
Here is the quick checklist: application, code, pinout, male or female side, straight or right-angle body, cable length, shield, jacket material, IP rating, voltage, current, temperature range, and mating connector.
What We Do When an M8 4-Pin Request Is Not Specific Enough
When we receive a request such as “We need an M8 4-pin waterproof cable for a compact network sensor,” we do not treat the size and pin count as enough information to quote the part immediately. An M8 4-pin connector can be A-coded, D-coded, or another layout, and each code is designed for a different job.
Our first step is to confirm the application. If the connector is for a basic sensor or actuator signal, we usually start by checking an A-coded M8 solution. If the connector is for industrial Ethernet or a network sensor, we check whether a D-coded M8 connector is required. We also review the mating face, pin assignment, male or female side, cable length, shielding requirement, jacket material, IP rating target, and working temperature before recommending a final part.
In a compact network sensor installation, the connector may sit near servo equipment, moving cable routes, dust, oil mist, vibration, or other EMI sources. In this situation, we would not recommend a standard A-coded sensor cable just because it is also M8 4-pin. Instead, we confirm the network signal requirement and consider an M8 4P D-code waterproof anti-vibration connector.
This process helps prevent common selection mistakes before the order is placed.
Waterproof M8 Connectors: What the IP Rating Really Means
IP67 and IP68 get used a lot in connector pages. They are helpful ratings, but they do not mean the connector can be treated badly and still seal forever.
The seal only works when the plug and receptacle are properly mated. If the thread is loose, the O-ring is damaged, the cable entry is weak, or the connector is left unmated without a cap, the real protection drops fast.
IP67, IP68, and IP69K are often mentioned together, but they do not mean the same thing. IP67 is commonly used for outdoor and factory environments with dust and short-term water exposure. IP68 should always come with a stated test depth and time. IP69K is used for washdown areas where high-pressure water and heat are part of the working conditions.
For M8 connectors, the IP rating should be checked together with the sealing details. O-ring material, shell material, cable overmold, locking method, and whether the rating applies only when the connector is fully mated can all affect real-world protection.

Shielded or Unshielded M8?
Short cable, clean signal, low-noise area? Unshielded may be fine. The choice changes when the cable route passes through a noisy part of the machine. A longer cable can pick up more electrical noise, almost like an antenna. Servo drives, VFD cabinets, welding equipment, and nearby power cables can all create electromagnetic interference, especially when motors start, stop, or change speed.
That is why shielded M8 is usually the safer choice for longer cable runs, mixed cable trays, or installations close to drives and high-power equipment. The shield helps protect sensor signals and data lines from outside noise, so the machine is less likely to see false triggers, dropped sensor signals, unstable Ethernet links, or random faults that only appear during certain machine cycles.
Shielding is not magic, though. It works best when the connector, cable shield, and grounding method are matched correctly. If the site has heavy EMI, ask the supplier to confirm the shielding structure and how the shield should be terminated.
When an M8 Connector Is the Right Fit
An M8 connector makes the most sense when the device is small, the cable route is tight, and the circuit does not need a large power connector. That is why it is so common on compact sensors, small actuators, I/O modules, and slim control boxes.
It is also a good fit when the machine has many small connection points close together. The smaller body helps save panel space and keeps wiring cleaner, especially around sensor brackets and tight equipment frames.
The main thing is to match the connector to the job. Check the code, pinout, rated current, cable type, shielding, and IP rating before choosing the final part. If those details fit the device and working environment, M8 is a clean and practical choice.
Buying Mistakes That Are Easy to Avoid
Ordering by size alone is risky. “M8” tells you the connector family, not the wiring.
Pin count is not enough either. “4-pin” still leaves the code open, and code changes the whole job.
The cable deserves more attention than it usually gets. Shielding, jacket material, bend radius, and overmold quality can decide whether the assembly works for six weeks or several years.
One more thing: do not trust IP67 as a magic shield. A sealed connector still needs the right mating part, clean sealing surfaces, and correct tightening.
Final Pre-Quote Checklist
- Application: sensor, actuator, I/O, Ethernet, servo, panel, or field device.
- Code: A-code, D-code, B-code, P-code, or another required layout.
- Pinout: L+, 0 V, signal, data pair, shield, or custom function.
- Connector side: male or female, cable end or panel mount.
- Body style: straight, right angle, front lock, or rear lock.
- Environment: dry, wet, oily, dusty, outdoor, washdown, or vibration-heavy.
- Cable: shielded or unshielded, jacket type, length, and bend radius.
- Ratings: voltage, current, IP rating, temperature, and mating cycles.



