The Raspberry Pi Zero 2 W uses the exact same 40-pin GPIO layout as the Raspberry Pi 3, 4, and 5. If you are wiring sensors, relays, or HATs, the BCM (Broadcom) pin numbering remains identical across these generations. Below is the complete reference table, followed by the specific traps that fry boards and the wiring color codes you need when interfacing with external control circuits.

The Complete Raspberry Pi Zero 2 Pinout Table

The physical header consists of two rows of 20 pins. Pin 1 is indicated by a square solder pad on the underside of the board and is located in the top-left corner when the board is oriented with the GPIO header on the right and the mini-HDMI port facing you. The table below maps the physical pin numbers to their Broadcom (BCM) GPIO numbers and primary alternate functions.

PinFunction / BCMFunction / BCMPin
13.3V Power5V Power2
3GPIO 2 (SDA1 / I2C)5V Power4
5GPIO 3 (SCL1 / I2C)Ground6
7GPIO 4 (GPCLK0)GPIO 14 (TXD / UART)8
9GroundGPIO 15 (RXD / UART)10
11GPIO 17GPIO 18 (PCM_CLK / PWM0)12
13GPIO 27Ground14
15GPIO 22GPIO 2316
173.3V PowerGPIO 2418
19GPIO 10 (MOSI / SPI)Ground20
21GPIO 9 (MISO / SPI)GPIO 2522
23GPIO 11 (SCLK / SPI)GPIO 8 (CE0 / SPI)24
25GroundGPIO 7 (CE1 / SPI)26
27GPIO 0 (ID_SD / I2C)GPIO 1 (ID_SC / I2C)28
29GPIO 5Ground30
31GPIO 6GPIO 12 (PWM0)32
33GPIO 13 (PWM1)Ground34
35GPIO 19 (PCM_FS)GPIO 1636
37GPIO 26GPIO 2038
39GroundGPIO 2140

Source: Official Raspberry Pi Hardware Documentation and the community-maintained Pinout.xyz database.

Rows People Get Wrong (And How to Avoid Bricking Your Pi)

The BCM2710A1 System-in-Package (SiP) inside the Zero 2 W is a 3.3V logic device. It has zero tolerance for 5V logic on the GPIO pins. Here are the most common pinout misinterpretations that lead to immediate hardware failure.

WARNING: The 5V vs 3.3V Trap
Pin 1 and Pin 17 output 3.3V. Pin 2 and Pin 4 output 5V. Accidentally wiring a 5V sensor output (like an HC-SR04 ultrasonic sensor) into a 3.3V GPIO pin (like GPIO 4 on Pin 7) will forward-bias the internal ESD protection diodes. This shorts the 5V rail to the 3.3V rail, instantly destroying the SoC. Always use a voltage divider or a logic level shifter for 5V inputs.

The I2C Pull-Up Backfeed (Pins 3 & 5)

GPIO 2 (SDA) and GPIO 3 (SCL) are hardwired to the 3.3V rail through 1.8kΩ physical pull-up resistors on the Pi PCB. If you connect a 5V I2C device that also has pull-up resistors tied to 5V, you will backfeed 5V through the Pi's 1.8kΩ resistors into the 3.3V rail. This causes the 3.3V rail to rise above 3.6V, corrupting the SiP memory controller and causing random kernel panics or permanent silicon damage.

The UART Console Conflict (Pins 8 & 10)

GPIO 14 (TXD) and GPIO 15 (RXD) default to outputting the Linux serial console at 115200 baud on boot. If you have a relay or motor controller connected to these pins, it will receive garbage data during the boot sequence, potentially triggering unintended mechanical movement. You must disable the serial console in raspi-config (Interface Options > Serial Port > Login shell: No, Hardware: Yes) before using these pins for general GPIO.

The EEPROM Reserved Pins (Pins 27 & 28)

GPIO 0 (ID_SD) and GPIO 1 (ID_SC) are strictly reserved for communicating with the EEPROM on Raspberry Pi HATs. They are used during the boot process to auto-configure GPIO directions. Do not wire external sensors or switches to these pins; doing so will cause HAT detection failures and boot delays.

Wiring Color Standards: IEC vs. NEC for Pi GPIO Projects

While the Pi's physical pinout is universal, the external wiring you connect to it for relays, optocouplers, and 24V industrial sensors must follow regional electrical color codes. When building enclosures or running cable bundles to external terminal blocks, applying the correct standard prevents lethal cross-wiring mistakes when mixing low-voltage Pi logic with mains-adjacent control circuits.

ApplicationIEC 60446 (EU / UK / AUS)NEC / US Convention
DC Control Power (+)BrownRed
DC Control Power (-)BlueBlack
24V AC Control (Hot)BrownBlack
24V AC Control (Neutral)BlueWhite
Protective Earth (Ground)Green/Yellow StripeGreen, Bare, or Green/Yellow
Signal / Data (Typical)Black or WhiteBlue, Yellow, or Orange

Reference: All About Circuits Wire Color Codes and IEC 60446 standards.

Safe Interpretation When Markings Are Faded or Missing

On older Pi Zero boards, or boards that have been reworked with aggressive flux cleaners, the silk-screen markings and the square Pin 1 pad can become illegible. Never guess pin orientation based on component placement.

  1. Locate Ground: Set your multimeter to continuity mode. Probe the outer metal shielding of the micro-USB power connector or the mini-HDMI port—this is tied to system ground. Use this to identify Pins 6, 9, 14, 20, 25, 30, 34, and 39.
  2. Locate Pin 1: Pin 1 is always the 3.3V supply. It is physically located in the corner closest to the micro-SD card slot. Measure voltage relative to your known ground pins with the board powered; Pin 1 will read exactly 3.3V, while Pin 2 (on the opposite row) will read 5.0V to 5.2V.
  3. Verify before wiring: If you are using a ribbon cable, ensure the red stripe (Pin 1 indicator) aligns with the verified 3.3V corner, not the 5V corner.

Frequently Asked Questions

Is the Raspberry Pi Zero 2 W pinout exactly the same as the Pi 4?

Yes, the physical 40-pin header and the BCM GPIO mapping are 100% identical to the Raspberry Pi 4 and Pi 5. Any HAT or wiring harness designed for the Pi 4 will physically and logically fit the Zero 2 W. However, the Zero 2 W lacks the dedicated power management ICs (PMICs) and heavy copper pours of the Pi 4. If your HAT draws more than 500mA from the 5V rail, you will experience voltage drops and brownouts on the Zero 2 that would not occur on a Pi 4.

Can I backfeed power through the 5V GPIO pins on the Zero 2?

You can, but it is highly discouraged. The Raspberry Pi Zero series has a PTC polyfuse on the main USB power input to protect against overcurrent. If you inject 5V directly into Pin 2 or Pin 4 (backfeeding), you bypass this polyfuse entirely. If your external power supply fails or a short occurs on your breadboard, there is no protective device between the power source and the Pi's PCB traces, which can lead to melted traces or a fire. Always power the Zero 2 W through the designated micro-USB or USB-C (on newer variants) port.

What standard applies to low-voltage DC sensor wiring?

For purely internal, low-voltage DC breadboard wiring (under 5V), there is no strict legal code, but industry convention dictates Red for VCC (3.3V or 5V), Black for GND, and Yellow/Orange/Blue for signal lines. However, the moment your Pi project interfaces with a 24V industrial control cabinet, a DIN-rail relay, or an external power supply, you must adhere to the IEC 60446 or NEC standards outlined in the table above to pass safety inspections and prevent maintenance electricians from miswiring your enclosure.

Why are my I2C sensors failing on GPIO 2 and 3?

If your I2C devices are returning 0x00 or timing out on i2cdetect -y 1, check your pull-up resistors. As noted in the 'Rows People Get Wrong' section, the Pi already has 1.8kΩ pull-ups on these pins. Many breakout boards (like the BME280 or MPU6050) also include 4.7kΩ or 10kΩ pull-ups. While parallel resistors usually just lower the total resistance, if the breakout board is powered by 5V instead of 3.3V, those pull-ups will inject 5V into the Pi's 3.3V I2C bus, causing the bus to lock up. Ensure all I2C devices on Pins 3 and 5 are strictly powered by the 3.3V rail (Pin 1).