The Raspberry Pi 3 (Model B and B+) features a 40-pin GPIO header. The universally recommended standard for software mapping is BCM (Broadcom SOC channel) numbering, while Physical (Board) numbering is used strictly for physical wiring, ribbon cables, and continuity testing. The Pi 3 operates strictly on 3.3V logic; feeding 5V into any GPIO data pin will permanently destroy the SoC.
The Complete 40-Pin GPIO Pinout Table
Below is the complete hardware reference for the Raspberry Pi 3 40-pin header. This layout is identical across the Pi 3 Model B, Pi 3 Model B+, Pi 4, and Pi 5, though power delivery capabilities on the 5V rail differ by generation.
| Physical Pin | BCM GPIO | Function / Notes | WiringPi (Legacy) |
|---|---|---|---|
| 1 | - | 3.3V Power (Max 50mA draw) | - |
| 2 | - | 5V Power (Fused) | - |
| 3 | 2 | SDA1 (I2C) - 1.8k Pull-up to 3.3V | 8 |
| 4 | - | 5V Power (Fused) | - |
| 5 | 3 | SCL1 (I2C) - 1.8k Pull-up to 3.3V | 9 |
| 6 | - | Ground | - |
| 7 | 4 | GPCLK0 | 7 |
| 8 | 14 | TXD (UART) - Shared with serial console | 15 |
| 9 | - | Ground | - |
| 10 | 15 | RXD (UART) - Shared with serial console | 16 |
| 11 | 17 | General Purpose I/O | 0 |
| 12 | 18 | PCM_CLK / PWM0 | 1 |
| 13 | 27 | General Purpose I/O | 2 |
| 14 | - | Ground | - |
| 15 | 22 | General Purpose I/O | 3 |
| 16 | 23 | General Purpose I/O | 4 |
| 17 | - | 3.3V Power (Max 50mA draw) | - |
| 18 | 24 | General Purpose I/O | 5 |
| 19 | 10 | MOSI (SPI0) | 12 |
| 20 | - | Ground | - |
| 21 | 9 | MISO (SPI0) | 13 |
| 22 | 25 | General Purpose I/O | 6 |
| 23 | 11 | SCLK (SPI0) | 14 |
| 24 | 8 | CE0 (SPI0 Chip Select) | 10 |
| 25 | - | Ground | - |
| 26 | 7 | CE1 (SPI0 Chip Select) | 11 |
| 27 | 0 | ID_SD (I2C) - Reserved for HAT ID | 30 |
| 28 | 1 | ID_SC (I2C) - Reserved for HAT ID | 31 |
| 29 | 5 | General Purpose I/O | 21 |
| 30 | - | Ground | - |
| 31 | 6 | General Purpose I/O | 22 |
| 32 | 12 | PWM0 / PCM_FS | 26 |
| 33 | 13 | PWM1 / PCM_DOUT | 23 |
| 34 | - | Ground | - |
| 35 | 19 | MISO (SPI1) / PCM_FS | 24 |
| 36 | 16 | CE2 (SPI1 Chip Select) | 27 |
| 37 | 26 | General Purpose I/O | 25 |
| 38 | 20 | MOSI (SPI1) / PCM_DIN | 28 |
| 39 | - | Ground | - |
| 40 | 21 | SCLK (SPI1) / PCM_DOUT | 29 |
Standard Variants: BCM vs. Physical vs. WiringPi
Unlike household wiring where regional codes (NEC vs. IEC) dictate color standards, the Raspberry Pi ecosystem is divided by software mapping standards. Choosing the wrong one is the leading cause of "my GPIO pin isn't working" forum posts.
- BCM (Broadcom SOC Channel): This maps to the internal Broadcom BCM2837 chip pin numbers. It is the undisputed standard for modern Python libraries (
gpiozero,RPi.GPIO) and C/C++ libraries (pigpio,lgpio). If you are writing code in 2026, use BCM. - Physical (Board): This simply counts the pins 1 through 40 based on their physical location on the header. Use this exclusively when crimping ribbon cables, designing custom PCBs, or verifying continuity with a multimeter. Never use Physical numbering in software unless you are writing a low-level hardware abstraction layer.
- WiringPi (Legacy): An Arduino-like numbering scheme created by Gordon Henderson. Deprecated in 2019. You will still find it in older C/C++ tutorials and legacy HAT documentation. Do not use it for new projects; migrate legacy code to
pigpioorlgpiousing BCM mapping.
Injecting 5V into Physical Pins 2 or 4 will backpower the Raspberry Pi 3, bypassing the onboard polyfuse and voltage regulation circuitry. If your external 5V source has any ripple or exceeds 5.25V, you risk destroying the Pi's PMIC (Power Management IC). Always power the Pi via the micro-USB port or use a HAT with proper backpower protection diodes.
Rows People Get Wrong (And How They Fry Their Pi)
When interpreting the pinout table above, three specific rows cause 90% of hardware failures and software bugs on the Pi 3.
1. Pin 1 (3.3V) vs. Pin 2 (5V) Reversal
The 3.3V rail on the Pi 3 is generated by an onboard LDO regulator and is strictly limited to ~50mA of external draw. If you accidentally wire a 5V sensor's VCC to Pin 1, it will either fail to power on or brown out the Pi. Conversely, wiring a 3.3V component (like an ESP8266 or NRF24L01) to Pin 2 (5V) will instantly fry the component.
2. GPIO 2 and GPIO 3 (I2C Hardware Pull-ups)
Physical pins 3 and 5 (BCM 2 and 3) are the primary I2C bus. The Pi 3 motherboard features hardwired 1.8kΩ pull-up resistors tying these lines to the 3.3V rail.
The Gotcha: If you attempt to use these pins as standard digital inputs with external push-buttons, the 1.8k pull-up will fight your external resistor network, causing floating logic states. Furthermore, never connect a 5V I2C device (like an Arduino Uno acting as a slave) directly to these pins without a bidirectional logic level shifter (e.g., BSS138 or PCA9306).
3. GPIO 14 and GPIO 15 (UART Console Spam)
Physical pins 8 and 10 (BCM 14 and 15) are the hardware UART. By default, the Pi 3 routes the Linux serial console to these pins. If you connect a GPS module or microcontroller here, your device will be bombarded with Linux boot logs and kernel panics.
The Fix: Run sudo raspi-config, navigate to Interface Options -> Serial Port, disable the "login shell to be accessible over serial", but enable the "serial port hardware".
Safe Pin Identification When Silkscreen is Faded
On older Pi 3 boards, or boards that have undergone heavy flux cleaning and rework, the white silkscreen "1" marking next to the first pin often wears off. Guessing Pin 1 incorrectly by even one row will route 5V directly into a 3.3V GPIO data pin.
Visual Landmark Method:
Orient the Pi 3 so the USB/Ethernet ports are facing toward you and the GPIO header is on the top right. Pin 1 is the top-left pin of the header, located closest to the microSD card slot edge. Pin 2 is immediately to its right.
Multimeter Verification Method (Foolproof):
If visual landmarks are ambiguous due to a custom case or damaged PCB:
- Power the Pi 3 via the official micro-USB power supply.
- Set your multimeter to DC Voltage (20V range).
- Place the black (COM) probe on the metal shielding of any USB port (this is a guaranteed Ground).
- Touch the red probe to the suspected Pin 1. If the meter reads 3.2V to 3.4V, you have found Pin 1.
- If the meter reads 4.9V to 5.2V, you are touching Pin 2. Move one pin to the left.
Decision Tree: Which Numbering Scheme and Library to Pick
Stop debating which standard to use. Follow this decision path to lock in your software and hardware stack for the Pi 3.
| If your scenario is... | Then choose this Standard... | And use this Library |
|---|---|---|
| Writing new Python scripts for sensors/relays | BCM | gpiozero (Built-in, handles cleanup automatically) |
| Writing high-frequency C/C++ bit-banging or PWM | BCM | pigpio (Runs as a daemon, hardware-timed PWM) |
| Crimping a 40-pin IDC ribbon cable to a perfboard | Physical | N/A (Hardware only; verify continuity pin-to-pin) |
| Maintaining a legacy C project from 2017 | WiringPi | wiringPi (Do not start new projects with this) |
| Interfacing with an Arduino via Serial | BCM (14/15) | pyserial (After disabling serial console in raspi-config) |
gpiozero Python library. It abstracts the pinout safely, prevents memory leaks from unclosed pins, and aligns with the official Raspberry Pi Documentation. Reserve Physical numbering strictly for your multimeter and wire-crimping tasks.
For interactive visual mapping and HAT compatibility checks, cross-reference your physical wiring with the community-maintained Pinout.xyz database before applying power to your breadboard.






