Raspberry Pi GPIO Pinout
Complete Raspberry Pi 40-pin GPIO reference.
| Interface | BCM Pins | Physical |
|---|---|---|
| UART | BCM 14 (TX), BCM 15 (RX) | Phys 8, 10 |
| I2C1 | BCM 2 (SDA), BCM 3 (SCL) | Phys 3, 5 |
| SPI0 | BCM 10 (MOSI), 9 (MISO), 11 (SCLK), 8 (CE0), 7 (CE1) | Phys 19,21,23,24,26 |
| SPI1 | BCM 20 (MOSI), 19 (MISO), 21 (SCLK), 18/17/16 (CE) | Phys 38,35,40,12,11,36 |
| PWM | BCM 12 (PWM0), BCM 13 (PWM1), BCM 18 (alt) | Phys 32,33,12 |
| 1-Wire | BCM 4 (default) | Phys 7 |
Raspberry Pi GPIO pinout — BCM numbers, physical pins, and alternate functions
The Raspberry Pi 40-pin GPIO header gives you access to digital I/O, PWM, SPI, I2C, UART, and power rails — but remembering which physical pin maps to which BCM number is something even experienced Pi users look up constantly. This interactive reference lets you switch between a grid view for quick function lookup and a physical header view that mirrors the actual pin layout on the board, so you can confidently wire up sensors and peripherals without counting pins on your Pi.
BCM vs physical (BOARD) pin numbering
Raspberry Pi GPIO has two numbering schemes. Physical (BOARD) numbering counts pins 1–40 from top-left to bottom-right of the 40-pin header as it sits on the board. BCM numbering follows the Broadcom chip's internal GPIO numbers, which are not sequential. Most software libraries (RPi.GPIO, gpiozero, pigpio) default to BCM numbering. In Python: GPIO.setmode(GPIO.BCM) uses BCM numbers; GPIO.setmode(GPIO.BOARD) uses physical positions. This reference shows both, so you can use either mode without confusion.
Key GPIO functions and which pins support them
I2C (GPIO 2 = SDA, GPIO 3 = SCL) connects sensors and displays using just two wires — common devices include BME280 temperature/humidity sensors, MPU6050 accelerometers, and SSD1306 OLED displays. SPI (GPIO 10 = MOSI, GPIO 9 = MISO, GPIO 11 = SCLK, GPIO 8/7 = CE0/CE1) is used for fast peripherals like SD cards, high-speed ADCs, and LoRa radio modules. UART (GPIO 14 = TXD, GPIO 15 = RXD) is used for serial communication with GPS modules, Arduino boards, and GSM modems. Hardware PWM is available on GPIO 12, 13, 18, 19 — software PWM is possible on any GPIO but produces jitter.
Voltage levels and current limits
All Raspberry Pi GPIO pins operate at 3.3 V logic — not 5 V tolerant. Connecting a 5 V signal directly to a GPIO input will damage the Pi. Use a logic level converter or a voltage divider (two resistors) to step 5 V Arduino signals down to 3.3 V. Each GPIO pin can source or sink a maximum of 16 mA, with a recommended maximum of 8 mA per pin for sustained use. The total current draw across all GPIO pins should not exceed 50 mA. For driving LEDs, always use a current-limiting resistor (330 Ω for a standard red LED on 3.3 V).
Compatible across Raspberry Pi models
The 40-pin GPIO header layout is consistent across Raspberry Pi 2, 3, 4, 5, and Zero/Zero 2 W. The original Model B and A had a 26-pin header (the first 26 pins are the same). This reference covers the full 40-pin standard used on all modern Pi boards. The Pi 5 introduced changes to the low-level GPIO implementation (using the new RP1 southbridge chip), so some timing-sensitive code may need adjustment, but the pin assignments remain the same.
Frequently asked questions
- What is BCM numbering?
- BCM (Broadcom SoC channel) numbering refers to the GPIO numbers assigned by the Broadcom BCM2835/2836/2837 chip itself — used in Python's RPi.GPIO library, pigpio, and gpiozero. Physical pin numbering counts the actual pin positions on the 40-pin header starting from pin 1 (closest to the SD card slot). BCM numbering is more commonly used in code; physical numbering is used when following pinout diagrams.
- Are Raspberry Pi GPIO pins 5V tolerant?
- No. All Raspberry Pi GPIO pins operate at 3.3V logic levels and are not 5V tolerant. Applying a 5V signal directly to any GPIO pin can permanently damage the Broadcom SoC — even a brief pulse at 5V is enough to destroy the pin or the entire chip. Always use a resistive voltage divider or a proper bi-directional logic level shifter when interfacing the Pi with 5V Arduino boards, sensors, or other 5V logic devices.
- How many GPIO pins does the Raspberry Pi have?
- The Raspberry Pi's 40-pin header includes 26 usable GPIO pins (using BCM numbering). The remaining 14 pins are allocated as: 2 pins at 5V power, 2 pins at 3.3V power, 8 ground pins, and 2 special pins (ID_SD and ID_SC) reserved for HAT EEPROM identification. The exact GPIO count and alternate functions vary slightly between Raspberry Pi models.
Related tools
- Resistor Color Code Calculator
Decode resistor color bands. Supports 4-band and 5-band.
- Ohm's Law Calculator
Calculate voltage, current, resistance, or power using Ohm's Law.
- Voltage Divider Calculator
Calculate output voltage for a resistor voltage divider.
- 555 Timer Calculator
Calculate frequency, duty cycle, and timing for 555 timer circuits.
- CRC Calculator Online — CRC-8, CRC-16, CRC-32 & Modbus
Calculate CRC checksums online — CRC-8, CRC-16/MODBUS, CRC-16/CCITT, CRC-32, CRC-32C and more. Shows HEX, DEC and BIN. Supports text and hex input. Browser-only, no upload.