Skip to content
GEEKnodes

Raspberry Pi

Raspberry Pi GPIO Pins Explained: Pinout, BCM and Limits

Raspberry Pi 40-pin pinout: physical vs BCM numbering, 3.3 V vs 5 V, max current per pin, I2C, SPI, UART, PWM and how not to fry your board.

The 40-pin header is what turns the Raspberry Pi into more than a mini computer: with it you can read sensors, light LEDs or talk to displays. This guide explains what each pin does, how they are numbered and which electrical limits you must not exceed.

In short

  • GPIOs work at 3.3 V and are not 5 V tolerant: putting 5 V on a pin can permanently damage the chip.
  • Each pin supplies at most about 16 mA, and Raspberry Pi states about 50 mA total for all GPIOs at once.
  • There are two numberings: physical (1 to 40, by position) and BCM/GPIO (what software uses). Do not mix them.

Data from the official Raspberry Pi documentation. The header is the same on the Pi 5, Pi 4, Pi 3 and Zero 2 W.

What is on the 40 pins

Not all pins are GPIOs. The header mixes several types:

TypeHow manyPurpose
5 V power2 (pins 2 and 4)Direct output from the power supply, no regulator
3.3 V power2 (pins 1 and 17)Output of the board’s regulator
Ground (GND)8Common reference for all circuits
GPIO26 (GPIO 2 to GPIO 27)Configurable digital inputs and outputs
ID EEPROM2 (pins 27 and 28, GPIO 0 and 1)Reserved for HATs to identify themselves

How to find your way on the board

  • Pin 1 is the one with the square pad on the board, in the corner nearest the microSD slot.
  • Odd pins (1, 3, 5…) form the inner row; even ones (2, 4, 6…) the edge row.
  • In a Raspberry Pi OS terminal you can see the ASCII map with:
pinout

Physical versus BCM numbering

This is the number one beginner mistake. The same pin has two names:

  • Physical (BOARD): its position on the header, 1 to 40.
  • BCM (or GPIO): the signal number on the chip. It is what almost all current libraries use.
First 12 pins of the header with physical number and BCM name: pin 3 GPIO 2 SDA, pin 11 GPIO 17, pin 8 GPIO 14 TX
The physical number is the position; BCM is the name software uses.
Physical pinBCM nameAlternate function
3GPIO 2I2C SDA
5GPIO 3I2C SCL
7GPIO 4GPCLK0
8GPIO 14UART TX
10GPIO 15UART RX
11GPIO 17General purpose
12GPIO 18PWM / PCM CLK
19GPIO 10SPI MOSI
21GPIO 9SPI MISO
23GPIO 11SPI SCLK
24GPIO 8SPI CE0
26GPIO 7SPI CE1
32GPIO 12PWM0
33GPIO 13PWM1

Example: if a tutorial says “connect the LED to GPIO 17”, it goes to physical pin 11, not pin 17 (which is a 3.3 V output).

With the gpiozero library included in Raspberry Pi OS, numbers are always BCM:

from gpiozero import LED
from time import sleep

led = LED(17)   # GPIO 17 = physical pin 11

while True:
    led.toggle()
    sleep(0.5)

Electrical limits: 3.3 V and few milliamps

Voltage: 3.3 V, never 5 V

GPIOs use 3.3 V logic. A “1” is 3.3 V and a “0” is 0 V. The official documentation is clear: they are not 5 V tolerant, and applying 5 V to a GPIO can permanently damage the SoC.

This matters when you connect modules designed for Arduino (which usually runs at 5 V):

  • A 5 V powered sensor that sends data to the Pi needs a voltage divider or a logic level shifter.
  • If the Pi only sends to a 5 V module, it usually works, because 3.3 V is normally read as “1”. Check its datasheet.

Current: very little

A GPIO lights an LED with a resistor, but a motor needs a transistor with its own power
A GPIO can drive an LED with a resistor; for a motor, use a transistor.
LimitOfficial value
Maximum current per pin16 mA
Total for all GPIOs at once50 mA
Default output drive strength8 mA

With these figures a GPIO can light one LED with its resistor (about 5–10 mA), but not a motor, a bare relay, a large buzzer or an LED strip.

For larger loads use a transistor, a MOSFET or a relay module with its own power, and let the GPIO only control the signal.

The 5 V and 3.3 V pins

  • The 5 V pins come straight from the power supply. What they can provide depends on the supply and what USB devices draw.
  • The 3.3 V pin comes from the board’s regulator and is for small sensors, not for motors or large displays.

Special pins: I2C, SPI, UART and PWM

Many GPIOs have alternate functions enabled from sudo raspi-config → Interface Options.

I2C (pins 3 and 5)

Two-wire bus for sensors, OLED displays, clocks… Several devices share the same two wires, each with its own address. Pins 3 and 5 have fixed 1.8 kΩ pull-ups to 3.3 V, so you do not need to add any.

sudo apt install i2c-tools
i2cdetect -y 1

SPI (pins 19, 21, 23, 24 and 26)

Faster than I2C, used for TFT displays, card readers or analog-to-digital converters. Each device needs its own chip select line (CE0, CE1).

UART (pins 8 and 10)

Serial port: the Pi’s TX goes to the other device’s RX and vice versa, with grounds joined. Useful for GPS modules or a console without network.

PWM (GPIO 12, 13, 18 and 19)

A signal switching on and off very fast to dim an LED or control a servo. There are two hardware PWM channels, available on those pins.

To understand when to use each bus, see I2C, SPI and UART: differences.

How not to fry your Raspberry Pi

  1. Always wire with the Pi powered off. A wire touching the 5 V pin to a GPIO while connecting is the classic cause of failure.
  2. Never connect 5 V or 3.3 V straight to GND: it is a short circuit.
  3. Always use a resistor with LEDs. Use the LED resistor calculator.
  4. Configure as input the pins that receive signals. Two outputs facing each other (one high, one low) fight.
  5. Join the grounds of the Pi and any external circuit.
  6. Use pull-up or pull-down resistors on buttons so the input is not “floating”.

Common problems

SymptomLikely cause
The LED does not lightPhysical and BCM confused, or LED reversed
The button gives random readingsInput without pull-up/pull-down
i2cdetect shows nothingI2C not enabled or SDA/SCL swapped
The Pi reboots when you connect somethingToo much load on 5 V or short circuit
A pin stopped respondingIt got 5 V or too much current

Frequently asked questions

Can I power the Raspberry Pi through the 5 V pins?

You can, but you bypass the USB-C input protections. Only with a stable, well-sized supply.

Is the pinout the same on the Pi 5?

Yes, the 40-pin layout is the same. The chip that controls them (RP1) changed, not the position.

Accessibility preferences

Quick profiles

Text and reading

Text size
Default
Line height
Default
Letter spacing
Default
Word spacing
Default

Colour

Motion and orientation

Cursor