Embedded hardware reference for engineers and makers

Raspberry Pi 40-Pin GPIO Universal Expansion Header (5, 4, 3, Zero)

40-pin interactive pinout

This page documents the standardized 40-pin GPIO expansion header (J8 header) shared across all modern Raspberry Pi single-board computers — including Raspberry Pi 5, 4B, 3B+, 3, 2, 1B+, Zero, and Zero 2 W. It serves as the unified hardware standard for sensors, expansion modules, and official HAT add-ons, exposing 28 general-purpose digital I/O lines (BCM GPIO), 3.3V and 5V power rails, dual I2C, SPI, UART, hardware PWM, and I2S/PCM audio channels.

  • Raspberry Pi Ltd
  • Verified source
  • Updated Sep 2026

Interactive pinout diagramTop

  • GPIO
  • Power
  • Ground

Tap a row of pins to see it up close

Raspberry Pi 40-Pin GPIO Header Pinout Vector DiagramInteractive vector pinout diagram of Raspberry Pi 40-Pin GPIO Header (top view) showing pin headers, power rails, components, and hardware interfaces.3V35VGPIO 25VGPIO 3GNDGPIO 4GPIO 14GNDGPIO 15GPIO 17GPIO 18GPIO 27GNDGPIO 22GPIO 233V3GPIO 24GPIO 10GNDGPIO 9GPIO 25GPIO 11GPIO 8GNDGPIO 7ID_SDID_SCGPIO 5GNDGPIO 6GPIO 12GPIO 13GNDGPIO 19GPIO 16GPIO 26GPIO 20GNDGPIO 21

BOARD SUMMARY

BCM2711 / BCM2712 / RP1 / BCM2837

Raspberry Pi 40-Pin GPIO Header

BCM2711 / BCM2712 / RP1 / BCM2837

Raspberry Pi Ltd
MCU
BCM2711 / BCM2712 / RP1 / BCM2837
CPU core
Quad-Core ARM Cortex-A72 / A76 / A53
Clock speed
1500 MHz
SRAM
4 GB
Flash
512 KB
GPIO count
28
Logic voltage
3.3 V (not 5 V tolerant)
Form factor
40-pin

Before you wire

GPIO is not 5 V tolerant

  • Never apply more than 3.3V to any GPIO pin. Exceeding 3.3V will permanently fry the Broadcom processor.
  • Exercise extreme care when probing pins 2 and 4 (5V); an accidental short to pin 1 (3.3V) or pin 3 (GPIO 2) will permanently destroy the board.
  • Do not pull pins 27 and 28 high or low during boot unless communicating with an official HAT EEPROM.

Pin table

Showing 40 of 40 pins
Raspberry Pi 40-Pin GPIO Header pin table: physical pin, name, GPIO, functions, ADC, touch, default role, flags
PinNameGPIOFunctionsADCDefault roleFlags
1 j83V3—
power
—Power Supply
2 j85V—
power
—Power Supply
3 j8GPIO 2GPIO2
gpioi2c
—GPIO
4 j85V—
power
—Power Supply
5 j8GPIO 3GPIO3
gpioi2c
—GPIO
6 j8GND—
gnd
—Ground
7 j8GPIO 4GPIO4
gpio
—GPIO
8 j8GPIO 14GPIO14
gpiouart
—GPIO
9 j8GND—
gnd
—Ground
10 j8GPIO 15GPIO15
gpiouart
—GPIO
11 j8GPIO 17GPIO17
gpiouart
—GPIO
12 j8GPIO 18GPIO18
gpiopwmi2s
—GPIO
13 j8GPIO 27GPIO27
gpio
—GPIO
14 j8GND—
gnd
—Ground
15 j8GPIO 22GPIO22
gpio
—GPIO
16 j8GPIO 23GPIO23
gpio
—GPIO
17 j83V3—
power
—Power Supply
18 j8GPIO 24GPIO24
gpio
—GPIO
19 j8GPIO 10GPIO10
gpiospi
—GPIO
20 j8GND—
gnd
—Ground
21 j8GPIO 9GPIO9
gpiospi
—GPIO
22 j8GPIO 25GPIO25
gpio
—GPIO
23 j8GPIO 11GPIO11
gpiospi
—GPIO
24 j8GPIO 8GPIO8
gpiospi
—GPIO
25 j8GND—
gnd
—Ground
26 j8GPIO 7GPIO7
gpiospi
—GPIO
27 j8ID_SDGPIO0
i2c
—GPIO
28 j8ID_SCGPIO1
i2c
—GPIO
29 j8GPIO 5GPIO5
gpio
—GPIO
30 j8GND—
gnd
—Ground
31 j8GPIO 6GPIO6
gpio
—GPIO
32 j8GPIO 12GPIO12
gpiopwm
—GPIO
33 j8GPIO 13GPIO13
gpiopwm
—GPIO
34 j8GND—
gnd
—Ground
35 j8GPIO 19GPIO19
gpiospipwmi2s
—GPIO
36 j8GPIO 16GPIO16
gpiouartspi
—GPIO
37 j8GPIO 26GPIO26
gpio
—GPIO
38 j8GPIO 20GPIO20
gpiospii2s
—GPIO
39 j8GND—
gnd
—Ground
40 j8GPIO 21GPIO21
gpiospii2s
—GPIO

Grounded reference

Board overview

Standardized 40-pin expansion header (J8) with 2.54mm pitch, common to Raspberry Pi models (5, 4B, 3B+, 3, Zero). Provides direct access to 28 BCM GPIO lines, I2C, SPI, UART, PWM, I2S buses, and 3.3V/5V power rails.

Power inputs

  • USB Type-C power input (5V DC, recommended 5V/3A for Pi 4 or 5V/5A PD for Pi 5)
  • Pins 2 & 4 (5V) and Pins 1 & 17 (3.3V) on the header for powering peripherals or supplying the board
  • Power over Ethernet (PoE / PoE+ HAT) via dedicated 4-pin header near the Ethernet jack

Common use cases

  • Stacking official and third-party HAT accessories (audio DACs, displays, motor controllers, sensor shields).
  • Industrial and home automation control, robotics, relay switching, and stepper motor control.
  • Building IoT gateways and environmental monitoring stations using I2C, SPI, and 1-Wire digital sensors.

Notes

  • Strict 3.3V Logic: GPIOs are NOT 5V tolerant. Always use bidirectional logic level converters when connecting 5V components.
  • Pins ID_SD (27) and ID_SC (28) are reserved for HAT ID EEPROM detection at boot — do not connect general peripherals here.
  • Pay close attention to Physical Pin numbers (1-40) vs BCM GPIO numbers (GPIO 0-27) in Python and C library configurations.

Before you wire

  • Never apply more than 3.3V to any GPIO pin. Exceeding 3.3V will permanently fry the Broadcom processor.
  • Exercise extreme care when probing pins 2 and 4 (5V); an accidental short to pin 1 (3.3V) or pin 3 (GPIO 2) will permanently destroy the board.
  • Do not pull pins 27 and 28 high or low during boot unless communicating with an official HAT EEPROM.

Specifications

MCU
BCM2711 / BCM2712 / RP1 / BCM2837
CPU core
Quad-Core ARM Cortex-A72 / A76 / A53
Clock
1500 MHz
SRAM
4194304 KB
Flash
0.5 MB
GPIO count
28
Logic voltage
3.3 V

Safe GPIO pins

Caution: Broadcom processors on Raspberry Pi boards operate strictly at 3.3V logic and are NOT 5V tolerant! Applying 5V to any GPIO pin will permanently destroy the SoC. Maximum current per GPIO is 16 mA, and aggregate draw from all 3.3V pins should not exceed 50 mA.

ADC and analog pins

Raspberry Pi boards have no native Analog-to-Digital Converters (ADC) on the 40-pin GPIO header. To read analog sensors, use external ADC converters connected via I2C or SPI (e.g., ADS1115 or MCP3008).

I2C, SPI and UART pins

Core interfaces: I2C1 on Pin 3 (SDA) & Pin 5 (SCL) with onboard 1.8 kΩ pull-ups; SPI0 on Pins 19 (MOSI), 21 (MISO), 23 (SCLK), 24 (CE0), 26 (CE1); Primary UART0 on Pins 8 (TXD) & 10 (RXD); Hardware PWM on GPIO 12, 13, 18, 19; I2S/PCM audio on GPIO 18 (CLK), 19 (FS), 20 (DIN), 21 (DOUT).

Strapping and boot pins

Pins 27 (ID_SD) and 28 (ID_SC) are dedicated to the HAT ID EEPROM on I2C0. They are reserved by the official HAT specification for hardware auto-identification at boot and must never be used as general-purpose GPIO or user sensors.

Input-only pins

All 28 BCM GPIO lines support software-configurable internal pull-up and pull-down resistors, edge-triggered interrupts, and drive strength configuration from 2 to 16 mA per pin.

Raspberry Pi Pico pinoutArduino Mega 2560 Rev3 pinoutArduino Pro Mini pinoutNodeMCU v2 Amica (ESP8266) pinout

Help keep this page accurate

Checked this pinout against your board or connector? Confirm it, or report a pin, voltage or orientation that does not match.

Opens a public form on GitHub with this page already filled in; a free GitHub account is needed. How reports and confirmations work