The standard Raspberry Pi (Models B+, 2, 3, 4, and 5) uses a 40-pin GPIO header. Pin 1 provides 3.3V, Pin 2 provides 5V, and Pin 6 is Ground. When orienting the board with the USB ports facing you and the GPIO header on the top right, Pin 1 is the top-left corner. Unlike mains wiring where regional codes dictate color and position, Raspberry Pi pinouts are governed by Broadcom silicon mappings and physical header layouts. Misinterpreting these standards is the leading cause of dead System-on-Chips (SoCs) on the workbench.
The Complete 40-Pin Raspberry Pi Pinouts Reference Table
This table maps the physical header layout to the Broadcom (BCM) silicon pins and their default alternate functions. Read it left-to-right, matching the physical pins on your board.
| Left Bank (Odd) | Function / BCM | Function / BCM | Right Bank (Even) |
|---|---|---|---|
| 1 | 3.3V Power | 5V Power | 2 |
| 3 | GPIO2 (SDA1 / I2C) | 5V Power | 4 |
| 5 | GPIO3 (SCL1 / I2C) | Ground | 6 |
| 7 | GPIO4 (GPCLK0) | GPIO14 (TXD / UART) | 8 |
| 9 | Ground | GPIO15 (RXD / UART) | 10 |
| 11 | GPIO17 | GPIO18 (PWM0) | 12 |
| 13 | GPIO27 | Ground | 14 |
| 15 | GPIO22 | GPIO23 | 16 |
| 17 | 3.3V Power | GPIO24 | 18 |
| 19 | GPIO10 (MOSI / SPI0) | Ground | 20 |
| 21 | GPIO9 (MISO / SPI0) | GPIO25 | 22 |
| 23 | GPIO11 (SCLK / SPI0) | GPIO8 (CE0 / SPI0) | 24 |
| 25 | Ground | GPIO7 (CE1 / SPI0) | 26 |
| 27 | GPIO0 (ID_SD / I2C) | GPIO1 (ID_SC / I2C) | 28 |
| 29 | GPIO5 | Ground | 30 |
| 31 | GPIO6 | GPIO12 (PWM0) | 32 |
| 33 | GPIO13 (PWM1) | Ground | 34 |
| 35 | GPIO19 (MISO1 / SPI1) | GPIO16 (CE2 / SPI1) | 36 |
| 37 | GPIO26 | GPIO20 (MOSI1 / SPI1) | 38 |
| 39 | Ground | GPIO21 (SCLK1 / SPI1) | 40 |
Numbering Standards: BCM vs. Physical vs. Board
In mains electrical work, you follow NEC or IEC color codes. In the embedded world, the "standards" are software numbering schemes. Choosing the wrong one in your code will result in toggling the wrong physical pin, which can be catastrophic if that physical pin is connected to a high-current load.
- BCM (Broadcom SOC Channel): This maps directly to the internal silicon pin numbers of the Broadcom BCM2711 (Pi 4) or BCM2712 (Pi 5). For example, Physical Pin 3 is BCM GPIO2. This is the native language of the hardware.
- BOARD (Physical): This simply counts the physical pins 1 through 40. Physical Pin 3 is BOARD Pin 3. It ignores the silicon mapping entirely.
- WiringPi: An older, deprecated numbering scheme created before the 40-pin header was standardized. Do not use this in 2026. The library is unmaintained and will cause mapping errors on Pi 4 and Pi 5 boards.
For authoritative visual mapping and real-time pin state checking, the community standard reference is Pinout.xyz, which provides interactive overlays for every official Pi board and HAT.
Board Variants and Faded Markings
While the 40-pin header has been standard since the Model B+ in 2014, you will encounter variants in the wild. Here is how to safely interpret them when silkscreen markings are faded or missing.
The 26-Pin Rev 1 Anomaly
The original 2012 Raspberry Pi Model B Rev 1 only had 26 pins. More dangerously, the I2C bus mapping was swapped. On Rev 1, Physical Pins 3 and 5 map to I2C Bus 0, whereas on all modern 40-pin boards, they map to I2C Bus 1. If you are salvaging an old Rev 1 board, your I2C Python scripts will fail silently unless you explicitly call Bus 0.
Raspberry Pi Pico (RP2040/RP2350)
The Pi Pico is a microcontroller, not a single-board computer, and its pinout is entirely different. It uses castellated edge pads numbered 1 through 40, but Pin 1 is not 3.3V. On the Pico, Pin 1 is GP0, and the 3.3V output is on Pin 36. Never assume a 40-pin footprint means the standard Pi GPIO map applies.
Rows People Get Wrong (And How They Fry Boards)
Based on years of bench troubleshooting, these are the specific pinout misinterpretations that destroy hardware.
1. The 3.3V vs 5V Power Rail Swap (Pins 1 & 2)
The Broadcom SoC operates strictly at 3.3V logic. Pin 1 provides 3.3V, and Pin 2 provides 5V. If you accidentally wire a 5V sensor output into a BCM GPIO pin, or worse, back-feed 5V into the 3.3V rail (Pin 1), you will instantly blow the internal voltage regulator or fry the SoC silicon. Always double-check Pin 1 orientation before applying power.
2. UART TX/RX Crossover (Pins 8 & 10)
Physical Pin 8 is TXD (Transmit) and Pin 10 is RXD (Receive). When wiring a serial GPS module or an Arduino via UART, beginners often wire TX to TX and RX to RX. Serial communication requires a crossover: the Pi’s TX (Pin 8) must connect to the peripheral’s RX, and the Pi’s RX (Pin 10) must connect to the peripheral’s TX.
3. The HAT EEPROM Pins (Pins 27 & 28)
Pins 27 (GPIO0/ID_SD) and 28 (GPIO1/ID_SC) are reserved for the HAT (Hardware Attached on Top) identification EEPROM. The Pi uses these during boot to read the HAT’s power requirements and automatically configure GPIO drive strengths. Do not use these pins for general-purpose I/O or secondary I2C sensors; doing so can cause boot loops or I2C bus collisions.
Decision Path: Choosing Your Pinout Strategy
Stop guessing which numbering scheme to use. Follow this decision matrix to lock in your configuration for both code and physical wiring.
| Scenario / Toolchain | Required Standard | Why |
|---|---|---|
Writing Python with gpiozero or RPi.GPIO |
BCM | Native library support; matches official Raspberry Pi documentation and datasheets. |
| Designing a custom PCB or wiring harness | Physical (BOARD) | Manufacturers drill holes based on physical 1-40 spacing (2x20 grid, 2.54mm pitch). |
Using C/C++ with pigpio or lgpio |
BCM | Low-level memory mapping requires direct Broadcom silicon addresses. |
| Porting legacy Arduino code | Physical (BOARD) | Arduino uses physical board pin numbers (D0-D13); mapping physical Pi pins reduces cognitive load. |
The Default Recommendation: If you are starting a new project today, use BCM for all software code and use Physical numbering for your physical wiring diagrams and silkscreen labels. This aligns with the official Raspberry Pi hardware documentation and prevents the translation errors that occur when trying to map physical pins to software variables in your head. Always define your pins as constants at the top of your script (e.g., LED_PIN_BCM = 17) to bridge the gap between the physical wire on Pin 11 and the software logic.






