Raspberry Pi
Raspberry Pi 5 GPIO Pinout
The 40-pin GPIO header on the Raspberry Pi 5 is pin-compatible with every modern Pi (4, 3, Zero 2 W). The Pi 5 swaps the BCM2711 for the BCM2712 and moves GPIO control to the new RP1 I/O chip, so a few low-level libraries that touched /dev/mem are broken on Pi 5 — use lgpio or gpiod instead of RPi.GPIO.
Specifications
- SoC
- Broadcom BCM2712 (4× Cortex-A76 @ 2.4 GHz)
- I/O controller
- RP1 (south bridge)
- GPIO logic level
- 3.3V — NOT 5V tolerant
- Total pins on header
- 40
- Programmable GPIOs
- 28 (GPIO 0–27)
- Hardware PWM
- 4 channels (GPIO 12, 13, 18, 19)
Pin reference
| Pin | Name | Type / functions | Notes |
|---|---|---|---|
| 1 | 3V3 | Power, ~500 mA | — |
| 2 | 5V | Power, from PSU | — |
| 3 | GPIO2 / SDA1 | I2C SDA | — |
| 4 | 5V | Power | — |
| 5 | GPIO3 / SCL1 | I2C SCL | — |
| 6 | GND | Ground | — |
| 7 | GPIO4 / GPCLK0 | Digital I/O | — |
| 8 | GPIO14 / TXD | UART TX | — |
| 9 | GND | Ground | — |
| 10 | GPIO15 / RXD | UART RX | — |
| 11 | GPIO17 | Digital I/O | — |
| 12 | GPIO18 / PWM0 | Hardware PWM | — |
| 13 | GPIO27 | Digital I/O | — |
| 14 | GND | Ground | — |
| 15 | GPIO22 | Digital I/O | — |
| 16 | GPIO23 | Digital I/O | — |
| 17 | 3V3 | Power | — |
| 18 | GPIO24 | Digital I/O | — |
| 19 | GPIO10 / MOSI | SPI0 MOSI | — |
| 20 | GND | Ground | — |
| 21 | GPIO9 / MISO | SPI0 MISO | — |
| 22 | GPIO25 | Digital I/O | — |
| 23 | GPIO11 / SCLK | SPI0 SCLK | — |
| 24 | GPIO8 / CE0 | SPI0 CE0 | — |
| 25 | GND | Ground | — |
| 26 | GPIO7 / CE1 | SPI0 CE1 | — |
| 27 | ID_SD (GPIO0) | Reserved for HAT EEPROM | — |
| 28 | ID_SC (GPIO1) | Reserved for HAT EEPROM | — |
| 29 | GPIO5 | Digital I/O | — |
| 30 | GND | Ground | — |
| 31 | GPIO6 | Digital I/O | — |
| 32 | GPIO12 / PWM0 | Hardware PWM | — |
| 33 | GPIO13 / PWM1 | Hardware PWM | — |
| 34 | GND | Ground | — |
| 35 | GPIO19 / PWM1 | Hardware PWM, I2S FS | — |
| 36 | GPIO16 | Digital I/O | — |
| 37 | GPIO26 | Digital I/O | — |
| 38 | GPIO20 / I2S DIN | Digital I/O | — |
| 39 | GND | Ground | — |
| 40 | GPIO21 / I2S DOUT | Digital I/O | — |
Gotchas
- 01GPIOs are 3.3V logic and NOT 5V tolerant — feeding 5V into a GPIO will damage the SoC. Use a level shifter for 5V sensors.
- 02On Pi 5, RPi.GPIO and pigpio do not work. Use lgpio, gpiozero (recent), or the libgpiod CLI (gpioset/gpioget).
- 03Pins 27/28 (GPIO 0/1) are reserved for HAT EEPROM detection — avoid for general use.
- 04Each GPIO can source/sink ~16 mA safely, with a hard total budget of 50 mA across the whole header.
Generate a wiring diagram
Describe your circuit and get a Mermaid diagram you can share.
Open diagram generator