The Raspberry Pi 5 retains the exact same physical 40-pin header layout as the Pi 4, but the underlying I/O architecture has fundamentally changed. The BCM2712 SoC no longer handles GPIO directly; instead, all peripheral I/O is routed through the custom RP1 southbridge chip. While the pin numbers and primary functions remain backward-compatible, the RP1 introduces different internal pull-up/pull-down resistor values, configurable drive strengths (2mA to 12mA), and stricter 3.3V rail limits. If you are wiring a new project or migrating an old HAT, you need to understand these electrical realities before applying power.

The Complete Raspberry Pi 5 GPIO Pinout Table

The table below maps all 40 physical pins. The Raspberry Pi 5 uses the standard Raspberry Pi 40-pin header specification. Note that while the physical pins are identical to older models, the RP1 chip handles the actual signal routing.

PinFunction / RP1 MappingPinFunction / RP1 Mapping
13.3V Power (Max ~50mA total)25V Power (Up to 2A with 27W PD)
3GPIO 2 (I2C1 SDA)45V Power
5GPIO 3 (I2C1 SCL)6Ground (GND)
7GPIO 48GPIO 14 (UART0 TXD)
9Ground (GND)10GPIO 15 (UART0 RXD)
11GPIO 1712GPIO 18 (PWM0)
13GPIO 2714Ground (GND)
15GPIO 2216GPIO 23
173.3V Power18GPIO 24
19GPIO 10 (SPI0 MOSI)20Ground (GND)
21GPIO 9 (SPI0 MISO)22GPIO 25
23GPIO 11 (SPI0 SCLK)24GPIO 8 (SPI0 CE0)
25Ground (GND)26GPIO 7 (SPI0 CE1)
27ID_SD (I2C0 SDA / HAT EEPROM)28ID_SC (I2C0 SCL / HAT EEPROM)
29GPIO 530Ground (GND)
31GPIO 632GPIO 12 (PWM0 Alt)
33GPIO 13 (PWM1 Alt)34Ground (GND)
35GPIO 19 (SPI1 MISO)36GPIO 16 (SPI1 CE2)
37GPIO 2638GPIO 20 (SPI1 MOSI)
39Ground (GND)40GPIO 21 (SPI1 SCLK)

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

Migrating from a Pi 4 to a Pi 5 or wiring a bare board without a HAT often leads to three specific, hardware-damaging mistakes. The RP1 peripherals datasheet outlines these electrical limits, but they are frequently overlooked in hobbyist builds.

⚠️ Callout: The 3.3V Rail Limit

Pins 1 and 17 output 3.3V. On the Pi 5, this rail is generated by an onboard LDO and is strictly limited to roughly 50mA total. If you wire multiple I2C sensors, an NRF24L01 radio, or a logic level shifter directly to the 3.3V pins, you will brownout the RP1 chip or permanently damage the voltage regulator. Fix: Use the 5V pins (2 or 4) and a dedicated buck converter (like an LM2596 or MP1584) to generate your own 3.3V rail for high-draw peripherals.

  • Feeding 5V into a GPIO Pin: The RP1 I/O banks are strictly 3.3V tolerant. Unlike older microcontrollers with 5V-tolerant inputs, injecting 5V into any pin from 3 to 40 (except the dedicated 5V power pins) will instantly destroy the RP1 southbridge. Always use a bidirectional logic level shifter (e.g., BSS138 or TXS0108E) when interfacing with 5V Arduino hardware.
  • Misusing Pins 27 and 28 (ID_SD / ID_SC): These are reserved for the HAT EEPROM I2C bus. The Pi 5 firmware uses these at boot to read HAT configuration data. If you wire standard I2C sensors here, the boot process will hang or throw I2C bus contention errors. Stick to Pins 3 and 5 for your primary I2C devices.
  • Assuming Default UART Works Out-of-the-Box: Pins 8 (TXD) and 10 (RXD) are mapped to the primary UART, but Raspberry Pi OS defaults to routing the serial login console to these pins. If you connect a GPS module or an ESP32 here without disabling the serial console in raspi-config (Interface Options -> Serial Port -> Login Shell: No, Serial Hardware: Yes), your device will receive garbage boot logs and fail to parse data.

Wire Color Standards: HATs vs. IEC vs. Dupont

When wiring external components to the Pi 5, mixing up wire color standards is a fast track to shorting the 5V rail to ground. Different ecosystems use different color codes. Here is how to interpret them based on your region and component type.

Standard / EcosystemRegion / OriginGround / NeutralPower / LiveSignal / Data
Raspberry Pi HAT SpecGlobal (UK Foundation)BlackRed (5V), Orange (3.3V)Yellow (SDA), Green (SCL), Blue (SPI)
Generic Dupont / JumperGlobal (China/US Hobbyist)Black (GND)Red (VCC)Random (often Yellow, Green, Blue)
IEC 60446 (AC/DC Mains)EU / UK / AUBlue (Neutral), Green/Yellow (Earth)Brown (Live)N/A (Not for low voltage data)
NEC / US AC MainsUS / CanadaWhite (Neutral), Bare/Green (Earth)Black (Hot)N/A
💡 Tip: The Mains-to-Pi Relay Trap

If you are using a relay module to switch AC mains loads based on Pi 5 GPIO signals, never use IEC/NEC mains wire colors on the low-voltage GPIO side of the relay. Keep the high-voltage side strictly Brown/Blue/Green-Yellow (IEC) or Black/White/Green (NEC), and use standard Black/Red Dupont wires for the Pi-to-Relay control signals (GND, VCC, IN). Mixing a Brown mains wire onto a Pi GPIO header is a lethal hazard if the wire is accidentally swapped.

Pin Selection Decision Tree

Don't just pick random GPIO numbers. The RP1 chip has specific hardware peripherals tied to specific pins. Use this decision path to select the correct pin for your protocol, ensuring you get hardware-accelerated performance rather than relying on slow software bit-banging.

If you need...Then choose...Why this specific pick?
Hardware I2C (Sensors, OLEDs)Pins 3 (SDA) & 5 (SCL)These are routed to I2C1 on the RP1. They include onboard 1.8kΩ pull-up resistors to 3.3V, saving you from adding external resistors for short runs.
Hardware SPI (Displays, SD Cards)Pins 19, 21, 23, 24This is SPI0 (MOSI, MISO, SCLK, CE0). It offers the highest DMA throughput on the RP1 for driving high-refresh SPI displays like the ILI9341.
Hardware PWM (Motor control, LEDs)Pins 12, 13, 32, or 33These pins map to the RP1's dedicated PWM slices. Pin 12 and 32 share a slice; Pin 13 and 33 share a slice. Use them for smooth, jitter-free dimming.
Hardware UART (GPS, Console)Pins 8 (TX) & 10 (RX)Maps to UART0. Essential for communicating with external microcontrollers without tying up the Pi's CPU with software serial interrupts.
Simple Digital I/O (Buttons, Relays)Pins 29, 31, or 37These are general-purpose GPIOs (5, 6, 26) with no default alternate functions mapped at boot, reducing the risk of peripheral conflicts.

Safe Interpretation When Markings Are Faded or Missing

If you are working with a second-hand Pi 5, a board with damaged silkscreen, or a custom carrier board where the pinout isn't printed, guessing the pinout will destroy the board. Follow this multimeter-based verification sequence to safely map the header.

  1. Locate Pin 1 via Physical Landmarks: Pin 1 is always the square solder pad (the other 39 are round). It is located in the corner closest to the USB-C power connector and the microSD card slot.
  2. Map Ground Pins (Unpowered): Set your multimeter to continuity mode (the diode/beep setting). Place one probe on the metal shield of the USB-C port (which is tied to system ground). Probe the header pins. Pins 6, 9, 14, 20, 25, 30, 34, and 39 will beep. Mark these as GND.
  3. Identify Power Rails (Powered): Power the Pi 5 via USB-C. Set your multimeter to DC Voltage. Place the black probe on a known GND pin. Probe the remaining pins on the outer edges (Rows 1 and 2). You will read exactly 4.9V to 5.1V on Pins 2 and 4, and 3.25V to 3.35V on Pins 1 and 17. Mark these immediately.
  4. Verify I2C Pull-ups: If you need to confirm Pins 3 and 5 are the primary I2C bus, measure the DC voltage on them relative to GND while the Pi is idle. Because the RP1 enables internal pull-ups, you should read approximately 3.3V on these pins even with no external devices connected.

By relying on physical landmarks and electrical measurements rather than faded silkscreen, you eliminate the risk of cross-wiring power rails and ensure your RP1 southbridge survives the prototyping phase.