Skip to main content
RUGGED COMPUTING · CONNECTORS

How Do You Connect M12 to RJ45?

An M12 Ethernet port connects to an RJ45 network with an M12 to RJ45 cable or adaptor that matches the port’s coding. A 4-pin D-coded M12 carries 10/100 Mbps Ethernet on RJ45 pins 1, 2, 3 and 6; an 8-pin X-coded M12 carries Gigabit and faster Ethernet on all eight RJ45 pins.

01

How M12 connects to RJ45

Connecting M12 to RJ45 means using a cable or adaptor with an M12 Ethernet connector at one end and an RJ45 plug or jack at the other. Both connectors carry exactly the same Ethernet signals; only the housing differs. M12 adds a sealed, screw-locked joint for wet, dirty or vibrating places, while RJ45 is the standard office and cabinet connector.

Check the coding on the device first. A D-coded port needs a D-coded M12 to RJ45 cable, and an X-coded port needs an X-coded one. They are not interchangeable, and a D-coded cable cannot carry Gigabit Ethernet even if both devices support it, because it only has two pairs.

02

Ways to join M12 and RJ45

There are five common ways to make the connection, and the right one depends on where the joint sits.

Option What it is Best for
M12 to RJ45 cable Molded cable, M12 plug at one end, RJ45 plug at the other Most installations, from device to switch
Panel feedthrough M12 socket on the outside of an enclosure, RJ45 jack inside Bringing a sealed port through a cabinet wall
Inline adaptor Short M12 to RJ45 coupler Bench testing and temporary links
Field-attachable plug M12 or RJ45 connector fitted to cut cable on site Custom lengths and repairs
Mixed-port switch Switch with M12 and RJ45 ports Joining several sealed devices to a standard network

Molded cables are the most reliable, because the factory seals and tests the joint. Field-attachable connectors save time on site but need care with the pair order and the seal.

03

How the pins map

The pairs, not the pin numbers, must line up. Swapping pins within a pair, or splitting a pair across two, causes errors or a dead link.

  • //
    D-coded, 4 pins. M12 pins 1 and 3 are one pair, going to RJ45 pins 1 and 2; M12 pins 2 and 4 are the other, going to RJ45 pins 3 and 6.
  • //
    X-coded, 8 pins. Four twisted pairs, on M12 pins 1-2, 3-4, 5-6 and 7-8, go to the four RJ45 pairs, for 1 Gbit/s to 10 Gbit/s.
  • //
    RJ45 wiring. The RJ45 end is normally wired to T568B, but any consistent scheme works as long as the pairs stay together.
04

Keep the seal where it matters

Put the M12 end on the rugged device and run the RJ45 end back to a switch in a dry cabinet. That keeps the sealed, vibration-proof connection at the equipment and the standard connector where the environment is controlled. Sealed RJ45 housings with bayonet covers do exist, but M12 is smaller, locks more securely under vibration and is easier to keep sealed over years of service.

Our IP67 computers and M12 Ethernet switches follow that layout: M12 at the machine, with the cabinet end left to the installer. Our guide to M12 waterproof connectors explains D and X coding in more detail.

FAQ · 01
What is an RJ45 connector?
RJ45 is the 8-pin modular plug and jack used for Ethernet on almost every computer, switch and router. It carries four twisted pairs, wired to the T568A or T568B color scheme, and suits dry, indoor connections.
Read the full FAQ —
05

Cable category, distance and PoE

An M12 to RJ45 link follows the normal Ethernet rules. The whole channel, including patch leads and couplers, should stay within 100 m, and each extra connector adds a little loss, so avoid chaining adaptors. Use Cat 5e class cable for D-coded and Gigabit X-coded links, and Cat 6A for 10 Gbit/s, as our Cat6 vs Cat6A guide explains. Industrial cables are almost always shielded, and the shield should be continuous from the M12 nut to the RJ45 shell.

Power over Ethernet runs over M12 as well as RJ45, if the cable is rated for it. D-coded links carry PoE on their two pairs; X-coded links can use all four. Check that the cable, any adaptors and both devices are rated for the PoE class in use.

06

Testing an M12 to RJ45 link

Most M12 to RJ45 faults show up in the link speed. If a Gigabit device and a Gigabit switch connect at 100 Mbit/s, a pair is open or swapped somewhere, or a D-coded cable has been used where an X-coded one was needed. If the link connects but drops under load, look for a damaged shield, a cable run past its length, or a chain of adaptors adding too much loss.

A basic cable tester with M12 adaptors checks the wiring map: every pin connected to the right partner, no shorts and no split pairs. For 10 Gbit/s links, use a certifier with M12 test adaptors that measures insertion loss and crosstalk at the full frequency, because a cable can pass a wiring test and still fail at 10 Gbit/s. Once installed, the switch’s port counters are the simplest check: a rising count of CRC errors on one port points straight at its cable.

07

Quick answers on M12 to RJ45

M12 to RJ45: common questions

Is there an M12 to RJ45 adaptor?

Yes. Inline adaptors and panel feedthroughs are available in D-coded and X-coded versions. A molded cable is usually more reliable for permanent use.

Can I use a D-coded cable for Gigabit?

No. D-coded cables have two pairs, so the link drops to 100 Mbit/s. Gigabit needs an X-coded cable with four pairs.

How do I wire M12 to RJ45?

Keep each pair together. For D-coded, M12 pins 1 and 3 go to RJ45 pins 1 and 2, and M12 pins 2 and 4 to RJ45 pins 3 and 6.

Does M12 to RJ45 support PoE?

Yes, with rated parts. The cable, adaptors and devices must all be rated for the PoE class you need.

Why is my M12 link only running at 100 Mbit/s?

Usually a pair problem. A D-coded cable, an open or swapped pair, or a damaged shield makes Gigabit devices fall back to 100 Mbit/s. Test the cable and check the coding.

Which end of the cable is male?

Usually both. Most cables have a male M12 plug for the device socket and a male RJ45 plug for the switch.

We supply every M12-equipped computer with the M12 to RJ45 cables its ports need as standard, matched for coding, speed, PoE and length, so the system connects to your network on day one.