The Raspberry Pi Zero puts a full Linux computer on a board the size of a stick of gum, with the same 40-pin GPIO layout as every other modern Raspberry Pi. The same HATs, wiring diagrams and gpiozero code all work. What's different is everything around the header: it usually comes without pins soldered on, the ports are miniature, there's one LED instead of two, and the serial port works differently on the wireless models.
Quick answer: the Zero, Zero W and Zero 2 W share the standard 40-pin pinout: I2C on GPIO 2/3 (pins 3, 5), SPI0 on GPIO 7–11, UART on GPIO 14/15 (pins 8, 10), hardware PWM on GPIO 12, 13, 18, 19, with 5 V on pins 2 and 4, 3.3 V on pins 1 and 17, and 26 usable GPIOs, all 3.3 V only. Pin 1 is the square pad at the end nearest the microSD slot. Buy a WH or 2 WH version if you don't want to solder the header.
Below: the full pin table, power, the bus pins, the UART and Bluetooth catch, the ACT LED, the Zero's ports and USB gadget mode, and the mistakes that catch first-time Zero owners.
Zero, Zero W and Zero 2 W
| Pi Zero | Pi Zero W | Pi Zero 2 W | |
|---|---|---|---|
| Processor | BCM2835, 1 core, 1 GHz | BCM2835, 1 core, 1 GHz | RP3A0 (BCM2710A1), 4 cores, 1 GHz |
| RAM | 512 MB | 512 MB | 512 MB |
| Wi-Fi / Bluetooth | No | 2.4 GHz Wi-Fi, Bluetooth 4.1 | 2.4 GHz Wi-Fi, Bluetooth 4.2 / BLE |
| 64-bit OS | No | No | Yes |
| Header pre-soldered | No | WH version | 2 WH version |
| 40-pin GPIO layout | Same | Same | Same |
The Zero 2 W is roughly five times faster on multi-threaded work and is the one to buy today; the original Zero and Zero W are only worth it if you already own them or need the lowest possible power draw.
The 40-Pin Header
| Pin | Function | Pin | Function |
|---|---|---|---|
| 1 | 3.3 V | 2 | 5 V |
| 3 | GPIO2 (I2C1 SDA) | 4 | 5 V |
| 5 | GPIO3 (I2C1 SCL) | 6 | GND |
| 7 | GPIO4 (GPCLK0) | 8 | GPIO14 (UART TX) |
| 9 | GND | 10 | GPIO15 (UART RX) |
| 11 | GPIO17 | 12 | GPIO18 (PWM0, PCM CLK) |
| 13 | GPIO27 | 14 | GND |
| 15 | GPIO22 | 16 | GPIO23 |
| 17 | 3.3 V | 18 | GPIO24 |
| 19 | GPIO10 (SPI0 MOSI) | 20 | GND |
| 21 | GPIO9 (SPI0 MISO) | 22 | GPIO25 |
| 23 | GPIO11 (SPI0 SCLK) | 24 | GPIO8 (SPI0 CE0) |
| 25 | GND | 26 | GPIO7 (SPI0 CE1) |
| 27 | ID_SD (HAT EEPROM) | 28 | ID_SC (HAT EEPROM) |
| 29 | GPIO5 | 30 | GND |
| 31 | GPIO6 | 32 | GPIO12 (PWM0) |
| 33 | GPIO13 (PWM1) | 34 | GND |
| 35 | GPIO19 (PWM1, PCM FS) | 36 | GPIO16 |
| 37 | GPIO26 | 38 | GPIO20 (PCM DIN) |
| 39 | GND | 40 | GPIO21 (PCM DOUT) |
Finding pin 1: it's at the end of the header nearest the microSD slot, on the inner row, and its pad on the underside is square while every other pad is round. Odd pins run along the inside row, even pins along the board edge.
Two numbering systems. Code uses BCM numbers (GPIO17); wiring diagrams often use physical positions (pin 11). They're different numbers for the same pin, and mixing them up is the most common Pi wiring mistake.
from gpiozero import LED
from time import sleep
led = LED(17) # BCM 17 = physical pin 11
while True:
led.toggle()
sleep(0.5)Pins 27 and 28 (GPIO0 and GPIO1) are reserved for the HAT identification EEPROM. Leave them alone unless you're designing a HAT.
Everything is 3.3 V and nothing is 5 V tolerant. A 5 V sensor output, an HC-SR04 echo line or an Arduino's TX needs a divider or level shifter. Each pin should be kept to a few milliamps (16 mA absolute maximum, and much less in total across all pins), so drive LEDs through a resistor and relays or motors through a transistor or driver board.
Power
Power the Zero through the micro-USB port labelled PWR IN, the one at the end of the board. Use a proper 5 V supply: the official one for the Zero 2 W is 5.1 V, 2.5 A. The original Zero and Zero W need less, but a weak phone charger or a long thin cable is still the most common cause of random reboots and corrupted SD cards, especially on the Zero 2 W under load.
| Pin | Use |
|---|---|
| 5 V (2, 4) | Connected straight to the USB power input. Powers small 5 V loads, or can power the board from a regulated 5 V supply |
| 3.3 V (1, 17) | From the onboard regulator. For sensors and modules, not motors or LED strips |
| GND (8 pins) | All connected together |
Feeding 5 V into the header pins bypasses the protection on the USB input, so a reversed or over-voltage supply goes straight to the board. Do it only with a well-regulated supply and the polarity double-checked.
I2C, SPI, UART and PWM
Enable the buses with sudo raspi-config → Interface Options, or by adding lines to /boot/firmware/config.txt (on Raspberry Pi OS Bookworm and later; older releases used /boot/config.txt).
| Interface | BCM pins | Physical pins | Linux device |
|---|---|---|---|
| I2C1 | SDA 2, SCL 3 | 3, 5 | /dev/i2c-1 |
| SPI0 | MOSI 10, MISO 9, SCLK 11, CE0 8, CE1 7 | 19, 21, 23, 24, 26 | /dev/spidev0.0, /dev/spidev0.1 |
| UART | TX 14, RX 15 | 8, 10 | /dev/serial0 |
| Hardware PWM | 12, 13, 18, 19 | 32, 33, 12, 35 | via dtoverlay=pwm-2chan |
I2C has 1.8 kΩ pull-ups on the board already. After enabling it, i2cdetect -y 1 lists connected devices.
from gpiozero import PWMLED
led = PWMLED(18)
led.value = 0.5 # 50 % brightness (software PWM is fine for LEDs)The UART and Bluetooth catch (Zero W and Zero 2 W)
The Pi has two UARTs: a full PL011 and a simpler mini UART. On the Zero W and Zero 2 W, the PL011 is connected to the Bluetooth chip, so GPIO 14/15 get the mini UART, whose baud rate drifts if the CPU clock changes. For a reliable serial link (GPS, an Arduino, a Modbus adapter) you have two options in /boot/firmware/config.txt:
dtoverlay=disable-btgives the PL011 back to GPIO 14/15 and turns Bluetooth off. Also runsudo systemctl disable hciuart.dtoverlay=miniuart-btkeeps Bluetooth working on the mini UART and gives the PL011 to the header.
Either way, use /dev/serial0 in your code; it always points at whichever UART is on GPIO 14/15. Turn off the serial login console in raspi-config if you want the port for your own device. The original Zero has no Bluetooth, so its PL011 is on the header already.
The ACT LED
Every Zero has a single green ACT LED and no red power LED, so a board that's powered but hasn't booted shows no light at all. The ACT LED flashes with SD card activity; when the Pi is fully shut down it stays off.
You can change what it shows in /boot/firmware/config.txt:
dtparam=act_led_trigger=heartbeat # double blink while Linux runs
# dtparam=act_led_trigger=none # use it as a plain LEDPorts and USB Gadget Mode
| Port | What you need |
|---|---|
| Mini-HDMI | A mini-HDMI to HDMI cable or adapter |
| Micro-USB USB (middle) | An OTG adapter for a keyboard, hub or USB stick |
| Micro-USB PWR IN (end) | Power only |
| Camera (CSI) | The narrower 22-pin connector; needs a Zero camera cable, not the standard Pi cable |
| Test pads (underside) | RUN (reset), and TV composite video on the W and 2 W |
There's no Ethernet port on any Zero. The USB port has a special trick: it can make the Zero appear to your computer as a USB network adapter or serial port ("gadget mode"), so a single cable gives you power and an SSH connection with no Wi-Fi, keyboard or screen. It's the classic way to set up a Zero on the go, and Raspberry Pi Imager can enable it on recent releases.
Headless setup: in Raspberry Pi Imager, open the settings before writing the card and set the hostname, a username and password, your Wi-Fi network (2.4 GHz only) and SSH. The Zero then joins Wi-Fi on first boot and you can ssh [email protected].
Common Mistakes
| Mistake | Fix |
|---|---|
| Wires pushed into the empty header holes | Solder a 2×20 header, or buy the WH / 2 WH version |
| Keyboard plugged into PWR IN | Use the middle port marked USB, through an OTG adapter |
| No light at power-on, assumed dead | There's no power LED; check the green ACT LED flickers during boot |
| Standard camera cable doesn't fit | The Zero needs the narrower Zero camera cable |
| Serial data garbled on a Zero W / 2 W | Mini UART on GPIO 14/15; use dtoverlay=disable-bt or miniuart-bt |
Edits to /boot/config.txt do nothing | On Bookworm the file is /boot/firmware/config.txt |
| Wi-Fi network not found | Zeros are 2.4 GHz only; use the 2.4 GHz network |
| Random reboots, SD card corruption | Use a 5 V / 2.5 A supply and a short cable |
| GPIO damaged by a 5 V module | Every pin is 3.3 V only; use a level shifter |
What the Zero Is Good For
A great fit: small always-on jobs where Linux helps, such as a Pi-hole, an MQTT broker or a small Node-RED instance on a Zero 2 W, a USB gadget, a Wi-Fi camera with the camera module, a sensor logger, or a retro game console. It uses well under a watt at idle on the original Zero.
A weaker fit: anything that needs precise timing (use a microcontroller such as a Pico or ESP32), heavy desktop use, or several USB devices at once.
FAQ
Is the Pi Zero pinout the same as the Pi 4 and Pi 5? Yes. The 40-pin header layout and pin functions are identical, so HATs and wiring diagrams carry over.
Does the Pi Zero have header pins? Not usually. The Zero, Zero W and Zero 2 W ship without them; the WH and 2 WH versions have them pre-soldered.
How many GPIO pins does the Pi Zero have? 26 usable GPIOs on the 40-pin header (BCM 2–27), plus power, ground and the two HAT EEPROM pins.
Are the GPIO pins 5 V tolerant? No. 3.3 V only.
Why is there no power LED? The Zero only has the green ACT LED, which shows SD card activity.
Which is the best Pi Zero to buy? The Zero 2 W, or the 2 WH if you don't want to solder.
Does RPi.GPIO work on the Zero? Yes, unlike on the Pi 5, but gpiozero is the recommended library on all Pi models.
Related guides: Raspberry Pi GPIO pinout reference (all 40-pin models) · Raspberry Pi 5 pinout · Install Mosquitto MQTT · Raspberry Pi Pico 2 pinout for a microcontroller alternative



