This guide gives you the full pin table plus what actually changes with RP1. For how the Pi 5 compares to the Pi 4 and Pico at a glance, see our Raspberry Pi GPIO Pinout overview.
Complete 40-Pin Reference Table
All 40 physical pins, in header order — identical to the Pi 4:
| Physical pin | Function | Physical pin | Function |
|---|---|---|---|
| 1 | 3.3V power | 2 | 5V power |
| 3 | GPIO2 (SDA, I2C) | 4 | 5V power |
| 5 | GPIO3 (SCL, I2C) | 6 | Ground |
| 7 | GPIO4 | 8 | GPIO14 (TXD, UART) |
| 9 | Ground | 10 | GPIO15 (RXD, UART) |
| 11 | GPIO17 | 12 | GPIO18 (PWM) |
| 13 | GPIO27 | 14 | Ground |
| 15 | GPIO22 | 16 | GPIO23 |
| 17 | 3.3V power | 18 | GPIO24 |
| 19 | GPIO10 (MOSI, SPI) | 20 | Ground |
| 21 | GPIO9 (MISO, SPI) | 22 | GPIO25 |
| 23 | GPIO11 (SCLK, SPI) | 24 | GPIO8 (CE0, SPI) |
| 25 | Ground | 26 | GPIO7 (CE1, SPI) |
| 27 | GPIO0 (ID_SD, reserved) | 28 | GPIO1 (ID_SC, reserved) |
| 29 | GPIO5 | 30 | Ground |
| 31 | GPIO6 | 32 | GPIO12 (PWM) |
| 33 | GPIO13 (PWM) | 34 | Ground |
| 35 | GPIO19 (PWM) | 36 | GPIO16 |
| 37 | GPIO26 | 38 | GPIO20 |
| 39 | Ground | 40 | GPIO21 |
All GPIO pins run at 3.3V logic and are not 5V tolerant — this hasn't changed with the Pi 5, despite occasional claims otherwise. Use a level shifter for any 5V sensors or devices.
What RP1 Actually Is, and Why It Matters
On every Raspberry Pi before the Pi 5, GPIO pins connected directly to the main processor. The Pi 5 changes that architecture: its main processor is a Broadcom BCM2712 (a significant CPU upgrade over the Pi 4's BCM2711), but GPIO, along with USB, Ethernet, and camera/display interfaces, is now handled by a separate I/O controller chip called RP1. RP1 communicates with the BCM2712 over a high-speed PCIe link rather than being wired directly into it.
Physically and electrically, nothing changes for you as a builder — the pin numbers, voltages, and functions are exactly what they were on the Pi 4. What changes is how the operating system talks to those pins under the hood, which is where the practical impact shows up.
Software Changes: RPi.GPIO, gpiozero, and gpiochip Paths
If you're bringing existing code over from a Pi 4, these are the two things most likely to break:
| What | Pi 4 | Pi 5 |
|---|---|---|
| RPi.GPIO library | Fully supported | Not compatible — the library was never updated for RP1 |
| Recommended library | RPi.GPIO or gpiozero | gpiozero (auto-detects Pi 5) or lgpio for lower-level control |
| Linux gpiochip device | /dev/gpiochip0 | A different gpiochip number tied to RP1 (commonly gpiochip4 on current Raspberry Pi OS releases, though this can shift between OS versions) |
If you have older tutorials, scripts, or third-party libraries that hardcode import RPi.GPIO or reference /dev/gpiochip0 directly, they'll either fail outright or silently target the wrong device on a Pi 5. Swapping to gpiozero resolves this for most use cases, since it's designed to detect which Pi model it's running on and adjust automatically.
HAT Compatibility
Because the physical header and pin assignments are unchanged, HATs designed for the Pi 4 (or Pi 3B+) fit and work electrically on the Pi 5 without modification. As with the Pi 4, GPIO0 and GPIO1 (physical pins 27, 28) are reserved for HAT ID EEPROM auto-detection — avoid using these for general I/O if you rely on HAT auto-configuration.
The one place compatibility can break isn't the header itself — it's software that assumes Pi 4-style direct GPIO access rather than going through RP1. A HAT with its own driver that hasn't been updated for RP1 support is the most likely source of trouble, not the physical connection.
Designing a custom HAT or add-on board for the Raspberry Pi 5? Get an instant PCB quote or request PCB assembly from NextPCB.
FAQ
Is the Raspberry Pi 5 GPIO pinout the same as the Pi 4?
Yes, physically and functionally identical — same 40-pin header, same BCM numbering, same pin functions. The difference is entirely in how the pins are controlled internally, via the new RP1 chip instead of direct connection to the main processor.
Why doesn't RPi.GPIO work on my Raspberry Pi 5?
The RPi.GPIO library was built around direct access to earlier Broadcom chips and was never updated to support the Pi 5's RP1 architecture. Use gpiozero, which automatically supports the Pi 5, or lgpio for lower-level access.
Are Raspberry Pi 4 HATs compatible with the Pi 5?
Yes, in terms of physical fit and electrical wiring — the header layout is identical. The main risk is a HAT's software driver assuming Pi 4-style direct GPIO access; check that the HAT's software has been updated for RP1 support if you run into issues.
Is the Raspberry Pi 5's GPIO 5V tolerant?
No. Despite occasional claims otherwise, Raspberry Pi 5 GPIO pins run at 3.3V logic and are not 5V tolerant, the same as every previous model. Use a level shifter for 5V devices.
