Guides

Cheat Sheet: Raspberry Pi GPIO

The 40 pins of the Raspberry Pi (all models with a 40-pin connector, from the Pi 1 B+ onwards). The Pi operates at 3.3 V: never connect 5 V to a GPIO pin. Use the button to print or save as PDF. An interactive version with search can be found in our GPIO pinout tool.

Function Pin Pin Function
3.3 V 1 2 5 V
GPIO2 (I2C SDA) 3 4 5 V
GPIO3 (I2C SCL) 5 6 Ground (GND)
GPIO4 7 8 GPIO14 (UART TX)
Ground (GND) 9 10 GPIO15 (UART RX)
GPIO17 11 12 GPIO18 (PWM0)
GPIO27 13 14 Ground (GND)
GPIO22 15 16 GPIO23
3.3 V 17 18 GPIO24
GPIO10 (SPI MOSI) 19 20 Ground (GND)
GPIO9 (SPI MISO) 21 22 GPIO25
GPIO11 (SPI SCLK) 23 24 GPIO8 (SPI CE0)
Ground (GND) 25 26 GPIO7 (SPI CE1)
GPIO0 (ID EEPROM SD) 27 28 GPIO1 (ID EEPROM SC)
GPIO5 29 30 Ground (GND)
GPIO6 31 32 GPIO12 (PWM0)
GPIO13 (PWM1) 33 34 Ground (GND)
GPIO19 (PWM1, SPI1 MISO) 35 36 GPIO16
GPIO26 37 38 GPIO20
Ground (GND) 39 40 GPIO21

Things to watch out for

  • The pin number (1 to 40, the position on the board) is not the same as the GPIO number. Pin 3 is GPIO2.
  • Pin 1 is on the SD card side, at the corner of the board. The odd pins are on the inside, the even ones on the outside.
  • Keep the current per pin low (around 16 mA, together not more than around 50 mA). For an LED, use a resistor: see the LED resistor tool.
  • GPIO0 and GPIO1 (pins 27 and 28) are intended for reading HAT boards; don’t use them for other things.
  • You can make a 5 V signal safe for a GPIO with a voltage divider or a level shifter.

The functions in parentheses are the default functions; many pins can do more. Check the Raspberry Pi documentation for the exact behavior on your model.