The Raspberry Pi Zero, Zero W, and the current Zero 2 W all share the exact same 40-pin GPIO header layout as the full-sized Pi models. Pin 1 provides 3.3V logic, Pin 2 provides 5V power, and Pin 6 is Ground. If you are wiring a HAT, a 40-pin IDC ribbon cable, or bare jumper wires, getting the physical-to-BCM mapping right is the difference between a working sensor and a fried voltage regulator. Below is the complete physical pinout reference, followed by the critical wiring standards and failure modes you need to know before applying power.
The Complete Raspberry Pi Zero Pinout Table (Physical vs. BCM)
The table below maps the physical header pins (1-40) to their Broadcom (BCM) GPIO numbers and alternate functions. Read the table as if you are looking down at the Pi with the GPIO header on the right side and the SD card slot on the left.
| Left Pin | Left Name / BCM GPIO | Right Name / BCM GPIO | Right Pin |
|---|---|---|---|
| 1 | 3V3 Power | 5V Power | 2 |
| 3 | GPIO 2 (SDA1 / I2C) | 5V Power | 4 |
| 5 | GPIO 3 (SCL1 / I2C) | Ground | 6 |
| 7 | GPIO 4 (GPCLK0) | GPIO 14 (UART TXD) | 8 |
| 9 | Ground | GPIO 15 (UART RXD) | 10 |
| 11 | GPIO 17 | GPIO 18 (PCM_CLK / PWM0) | 12 |
| 13 | GPIO 27 | Ground | 14 |
| 15 | GPIO 22 | GPIO 23 | 16 |
| 17 | 3V3 Power | GPIO 24 | 18 |
| 19 | GPIO 10 (MOSI / SPI) | Ground | 20 |
| 21 | GPIO 9 (MISO / SPI) | GPIO 25 | 22 |
| 23 | GPIO 11 (SCLK / SPI) | GPIO 8 (CE0 / SPI) | 24 |
| 25 | Ground | GPIO 7 (CE1 / SPI) | 26 |
| 27 | GPIO 0 (ID_SD / I2C) | GPIO 1 (ID_SC / I2C) | 28 |
| 29 | GPIO 5 | Ground | 30 |
| 31 | GPIO 6 | GPIO 12 (PWM0) | 32 |
| 33 | GPIO 13 (PWM1) | Ground | 34 |
| 35 | GPIO 19 (PCM_FS) | GPIO 16 | 36 |
| 37 | GPIO 26 | GPIO 20 | 38 |
| 39 | Ground | GPIO 21 | 40 |
Rows People Get Wrong (And How to Avoid Bricking Your Pi)
Even experienced makers occasionally miswire a Pi Zero because the physical header layout does not perfectly align with logical software numbering. Here are the most common pinout mistakes and how to avoid them.
BCM vs. Physical Numbering in Software
The most frequent error occurs in Python code. The legacy RPi.GPIO library defaults to BOARD (physical) numbering, while the modern gpiozero library defaults to BCM (Broadcom) numbering. If you wire an LED to Physical Pin 11 (BCM GPIO 17) and write LED(11) in gpiozero, you are actually toggling BCM GPIO 11 (Physical Pin 23), leaving your LED dark. Always explicitly declare your numbering scheme or verify the library default.
The 3.3V vs. 5V Backfeed Trap
I2C Pins Have Onboard Pull-Ups
Pins 3 (SDA) and 5 (SCL) are hardwired to the primary I2C bus and feature 1.8kΩ pull-up resistors connected to the 3.3V rail. If you connect a 5V I2C sensor directly to these pins without a bidirectional logic level shifter, the 5V sensor will pull the line high to 5V, backfeeding the 3.3V rail through the pull-ups and potentially damaging the Pi.
Wiring Color Standards: IDC Ribbons and Regional Mains Relays
When expanding your Pi Zero with ribbon cables or switching external loads, you must adhere to established wiring color standards. Misinterpreting these colors is a primary cause of jobsite and bench failures.
40-Pin IDC Ribbon Cable Standard
If you are using a standard 40-pin IDC (Insulation Displacement Contact) ribbon cable to connect a GPIO breakout board or a Pi HAT, the standard dictates that Pin 1 is always indicated by a red or brown stripe on the edge of the cable. The remaining wires are typically grey. Never assume the cable is keyed correctly; cheap imported cables sometimes have the connector crimped backward. Always verify the red stripe aligns with Physical Pin 1 (the 3.3V pin) on both the Pi and the breakout board.
Regional Mains Wiring for Relay Modules
The Pi Zero GPIO outputs 3.3V at a maximum of 16mA, which is insufficient to drive a mechanical relay coil directly. You must use an opto-isolated relay module or a MOSFET driver. While the low-voltage side uses standard jumper wires, the high-voltage load side of the relay must follow your region's electrical code. Below is the standard color mapping for 120V/230V AC wiring connected to the relay's Common (COM), Normally Open (NO), and Normally Closed (NC) terminals.
| Wire Function | US / Canada (NEC) | EU / UK (IEC 60446) | Old UK (Pre-2004) |
|---|---|---|---|
| Line / Hot | Black (or Red) | Brown | Red |
| Neutral | White | Blue | Black |
| Earth / Ground | Green / Bare Copper | Green-Yellow Stripe | Green |
Note: The Pi Zero's ground (GND) pins are for low-voltage DC logic reference only. Never connect the AC Earth/Ground wire to the Pi's GPIO GND pins. The AC ground must terminate at the relay module's chassis or the mains earth terminal, maintaining strict galvanic isolation from the Pi. For authoritative guidance on mains wiring, consult the NFPA National Electrical Code (NEC) or the IEC international standards.
Safe Interpretation When Silkscreen Markings are Faded or Missing
On older Pi Zero boards, or boards that have spent years in a dusty enclosure, the tiny white silkscreen text indicating '5V', 'GND', and 'GPIO' can wear off entirely. Guessing the pinout will fry your board. Follow this diagnostic procedure to safely identify the header.
Step 1: Identify Pin 1 by the Solder Pad Shape
Look closely at the solder pads on the underside (or topside, if unpopulated) of the GPIO header. Pin 1 is the only pin with a square solder pad. All other pins (2 through 40) have perfectly round solder pads. Once you locate the square pad, orient the board so the SD card slot is on the left and the GPIO header is on the right; Pin 1 will be the top-left pin of the header.
Step 2: Verify Ground via the USB Shield
If you cannot see the pads, set your multimeter to continuity mode (the diode/beep setting). Place one probe on the metal shield of the micro-USB or mini-USB power connector. Touch the other probe to the suspected Ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39). The multimeter should beep, indicating less than 1 ohm of resistance. This confirms your ground reference without applying power.
Step 3: Live Voltage Verification
Power the Pi Zero via the USB port. Set your multimeter to DC Voltage. Place the black probe on a confirmed Ground pin. Touch the red probe to Pin 2. You should read between 4.8V and 5.2V. Next, touch the red probe to Pin 1. You should read exactly 3.3V (typically 3.28V to 3.32V). If Pin 1 reads 0V, the onboard LDO regulator has failed, and the board should be replaced. For a complete visual and technical breakdown of the board layout, refer to the official Raspberry Pi hardware documentation.
By relying on physical pad geometry and multimeter verification rather than faded ink, you ensure a safe, reliable connection every time you interface external sensors, relays, or displays with your Pi Zero.






