The Raspberry Pi 5 maintains the physical 40-pin header layout of its predecessors, but the shift to the RP1 southbridge chip fundamentally changes the electrical behavior of the rpi5 gpio pinout. Below is the definitive hardware reference you need before wiring your next sensor, relay, or HAT.

The Complete Raspberry Pi 5 GPIO Pinout Reference

Read this table with the board oriented so the USB ports face you and the GPIO header is on the top right. Pin 1 is the top-left pin (closest to the USB-C power connector). All logic levels are strictly 3.3V.

Pin Function / BCM GPIO Pin Function / BCM GPIO
13.3V Power25V Power
3GPIO 2 (SDA1 / I2C)45V Power
5GPIO 3 (SCL1 / I2C)6Ground (GND)
7GPIO 4 (GPCLK0)8GPIO 14 (TXD / UART)
9Ground (GND)10GPIO 15 (RXD / UART)
11GPIO 1712GPIO 18 (PWM0)
13GPIO 2714Ground (GND)
15GPIO 2216GPIO 23
173.3V Power18GPIO 24
19GPIO 10 (SPI MOSI)20Ground (GND)
21GPIO 9 (SPI MISO)22GPIO 25
23GPIO 11 (SPI SCLK)24GPIO 8 (SPI CE0)
25Ground (GND)26GPIO 7 (SPI CE1)
27ID_SD (I2C ID)28ID_SC (I2C ID)
29GPIO 530Ground (GND)
31GPIO 632GPIO 12 (PWM0)
33GPIO 13 (PWM1)34Ground (GND)
35GPIO 19 (SPI MISO)36GPIO 16 (SPI CE2)
37GPIO 2638GPIO 20 (SPI MOSI)
39Ground (GND)40GPIO 21 (SPI SCLK)

Wire Color Codes and Regional Wiring Standards

When building enclosures that route GPIO signals out to external sensors or mains-powered relays, you must separate low-voltage logic wiring from high-voltage mains wiring. Confusing hobbyist jumper colors with regional mains color codes is a primary cause of catastrophic board failure and electrical shock.

⚠️ WARNING: Never use standard low-voltage hobbyist wire colors (Red/Black) for routing 120V/230V AC mains to a relay block. Always follow your regional electrical code for mains wiring, and keep physical separation between GPIO logic wires and AC lines inside your enclosure.

Low-Voltage GPIO & Sensor Wiring (Hobbyist / DIN)

  • Red: 5V or 3.3V Power (VCC)
  • Black: Ground (GND)
  • Yellow / Orange: Digital Signal / Data
  • Green / White: Secondary Data (e.g., I2C SDA/SCL pairs)

Mains Wiring Standards (For External Relay Loads)

If your Pi 5 is switching a relay that controls a mains load, the wiring on the load side of the relay must follow your local jurisdiction's code. Here is how the standards differ globally:

Region / Standard Live / Hot Neutral Earth / Ground
IEC 60446 (EU, UK, AU, Global Industrial) Brown Blue Green/Yellow Stripe
Old UK (Pre-2004 installations) Red Black Green
US NEC (North America 120V/240V) Black (or Red for L2) White (or Grey) Bare Copper / Green

Source reference: Raspberry Pi Official Hardware Documentation

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

The RP1 southbridge chip on the Pi 5 acts like a traffic cop between the main BCM2712 CPU and the GPIO header. While it handles routing beautifully, it is far less forgiving of electrical abuse than older Broadcom chips. Here are the specific rows and assumptions that destroy boards.

1. Assuming 5V Tolerance on Any GPIO Row

The Mistake: Plugging a 5V logic sensor (like an older HC-SR04 ultrasonic module) directly into GPIO 4 (Pin 7) or any other signal pin.
The Reality: The RP1 chip is strictly 3.3V. Feeding 5V into a GPIO pin will bypass the internal protection diodes, overheat the silicon, and permanently short the pin to VCC.
The Fix: Use a bidirectional logic level shifter (like the BSS138 MOSFET-based shifters) or a simple voltage divider (e.g., 2kΩ and 3.3kΩ resistors) to drop 5V signals down to 3.3V.

2. Misusing the I2C Pins (Rows 3 & 5) Without Pull-Up Calculations

The Mistake: Assuming the internal pull-ups on GPIO 2 and GPIO 3 are sufficient for long I2C bus runs.
The Reality: The RP1 handles internal pull-ups differently than the BCM2711. For reliable I2C communication, especially with capacitive loads like long wires or multiple sensors, you need external physical pull-up resistors.
Numeric Example: If your I2C device can sink a maximum of 3mA and you are running at 3.3V, Ohm's law ($R = V / I$) dictates a minimum resistance of $3.3 / 0.003 = 1100\Omega$. A standard 1.2kΩ or 2.2kΩ external pull-up resistor to the 3.3V rail (Pin 1) is the bench-standard fix for flaky I2C data.

3. Wiring Signals to Pins 27 & 28 (ID_SD / ID_SC)

The Mistake: Using Pins 27 and 28 as general-purpose I/O because they are labeled with I2C functions.
The Reality: These pins are reserved exclusively for the HAT identification EEPROM. They are accessed by the firmware at boot. Attaching external sensors here can cause boot loops or prevent HAT auto-configuration. Leave them unconnected unless you are designing a custom HAT.

Frequently Asked Questions

Is the Raspberry Pi 5 GPIO pinout physically identical to the Pi 4?

Yes, the physical 40-pin layout, power pins (5V/3.3V/GND), and standard BCM GPIO numbering remain identical to the Pi 4. This ensures backward compatibility with almost all existing HATs. However, the electrical behavior is managed by the new RP1 chip, which changes how PWM channels are allocated and how internal pull-up/pull-down resistors are configured in software.

Are Raspberry Pi 5 GPIO pins 5V tolerant?

Absolutely not. No pin on the 40-pin header (other than the dedicated 5V power pins on Row 2 and 4) can accept 5V logic. The RP1 southbridge operates strictly at 3.3V. Applying 5V to a signal pin will cause immediate, irreversible thermal damage to the RP1 I/O pad. Always verify sensor output voltages with a multimeter before connecting them to the Pi 5.

How do I identify Pin 1 if the board markings are faded or missing?

If the silkscreen is worn off or you are using a clone board with poor markings, look at the solder pads on the underside (or topside) of the header. Pin 1 is the only pad with a square shape; all other pins have round or oblong pads. Additionally, Pin 1 is always located on the edge of the board closest to the USB-C power input port, on the left side of the header when the USB-A ports are facing toward you.

What changed with I2C and SPI on the RP1 chip?

While the default header mappings (SPI0 on pins 19/21/23/24/26 and I2C1 on pins 3/5) remain the same, the RP1 chip actually exposes up to three independent SPI interfaces and multiple I2C buses internally. Advanced users can remap these alternate functions via the config.txt or device tree overlays. Furthermore, the RP1 supports hardware clock stretching for I2C natively, which solves a long-standing issue with slower sensors (like certain MLX90614 temperature modules) that previously required software bit-banging on older Pi models. For deeper overlay configurations, consult the Pinout.xyz RPi 5 interactive guide.