Raspberry Pi Pinout
The Raspberry Pi's 40-pin GPIO header follows a fixed, well-documented layout, and knowing which physical pin maps to which power rail or GPIO/BCM number is essential before wiring anything to it.
The 40-Pin Header
Every current full-size Raspberry Pi board, along with the Zero line, shares the same 40-pin header layout, arranged as two rows of 20 pins. Pin 1 is the corner closest to the SD card slot, usually marked with a square solder pad or a small "1" printed on the board itself; odd-numbered pins run down one row and even-numbered pins down the other. Because the layout is standardized across models, a HAT (Hardware Attached on Top) or breakout board designed for one modern Pi will physically line up on any other.
Power Pins
The header carries two kinds of power rail. Pins 2 and 4 supply 5V taken almost directly from whatever power source feeds the board, so they carry more current but bypass onboard regulation, meaning they're better suited to powering small add-on boards than sensitive sensors. Pins 1 and 17 supply 3.3V through the board's onboard regulator, which has a limited total current budget shared across everything connected to it, so it suits low-power sensors and logic rather than motors or bright LED strips.
Ground Pins
Eight pins on the header (6, 9, 14, 20, 25, 30, 34, and 39) are all ground, and electrically they're all the same net, so it doesn't matter which one you use. A complete circuit always needs a ground connection back to the Pi in addition to whichever signal or power pin you're using, so pick whichever ground pin is physically convenient for your wiring.
Special-Function Pins
- I2C (physical pins 3 and 5, GPIO2/GPIO3): a two-wire bus for sensors and small displays that support addressing multiple devices on the same two lines
- SPI (physical pins 19, 21, 23, 24, and 26): a faster bus typically used for displays, SD card readers, and analog-to-digital converters
- UART (physical pins 8 and 10, GPIO14/GPIO15): a simple serial link, often used for a debug console or communicating with serial hardware like GPS modules
- PWM-capable pins (including GPIO12, GPIO13, GPIO18, and GPIO19): useful for dimming LEDs or controlling servo motors
Printing Your Board's Pinout
# gpiozero ships with Raspberry Pi OS by default
pinout
# Prints an ASCII diagram of your specific board's header,
# with physical pin numbers and BCM/GPIO numbers shown side by side