Skip to main content

Raspberry Pi GPIO Bus Pinouts

The tables on this page show the pin-outs for the GPIO header on the Raspberry Pi connector.
This is the double row of closely spaced pins on the top-side of the board, in the upper left corner if the board is held with the USB connector on the right-hand edge of the board.

With the board held in this orientation, the top row of pins are numbered with even numbers from two to twenty-six, left to right. This is the row of pins closest to the top edge of the board.

The lower row are numbered with odd numbers from 1 to twenty-five.

Don't attempt to connect anything to these pins unless you are sure you know what you are doing.
There are plenty of projects and notes about interfacing to the GPIO bus on the Raspberry Pi Foundation web pages and elsewhere.

I cannot be held responsible for any damage caused to a Raspberry Pi by incorrect or imprudent use of the GPIO pins.

Also be aware that the Raspberry Pi hardware is static sensitive. Do not be tempted to touch the GPIO pins casually, even if the box you have used has a cut-out to allow for external connection of a header cable or adaptor.

Pay close attention to the revision number of your board.

To get the revision number of your board, issue the following command:

cat /proc/cpuinfo

There will be one line which prints a line starting with 'Revision' and a hexadecimal number. If the number is 4, 5, 6, 14 (e) or 15 (f), you have a revision 2 board.

Another way to tell between revision 1 and 2 boards is to look for the 2 millimetre mounting hole just to the left of the USB connector, if you are holding the board in front of you with the short side and the USB connector away from you. You can find this hole with your thumbnail or the point of a pencil (without power connected).

To connect a header plug, or any other device into the GPIO header; first shutdown any operating system that is running on the Pi. Disconnect all the cables and make sure your body and your hands are at the same potential as the board. I do this by only handling the board with my forearms planted firmly on the table surface. Offer any plug to the GPIO pins very gently and don't force it on. It is very easy to bend the pins on the header and a few moments taken to do this very carefully could avoid permanent damage to your Raspi.

So far I have only connected a full 26 way IDC plug to each of my Raspis and I would recommend you invest in something like an Adafruit Cobbler. Using such a device you could plug into the Raspi just once and then make any changes at the other end of the ribbon cable, thus minimising any potential for accidents.

It's cheaper and less distressing to destroy the other end of a ribbon cable than it is to break your precious little computer.

If you want to connect something to the GPIO pins other than a full 26-way header, like a 2-wire connector for the I2C serial line, confirm you have connected to the correct pins by counting along the line of unconnected pins with a fingernail, gently. Do this several times. The old carpentry maxim of 'measure twice, cut once' is a good one.

Under no circumstances attempt to solder direct to the GPIO pins, even if you get someone who can see to do this for you. The stray currents present on the tip of a soldering iron can be death to the delicate insides of the SoC, and nasty solder on those nice gold pins will stop you connecting a header plug at a later time.

Note: Added 2014-07-18: The additional fourteen pins on the new Model B+ are now shown in two new tables at the bottom of this page. As before the evenly numbered pins are those closest to the edge of the board and the oddly numbered pins are furthest from the edge of the board.

P1 Header Pinout, top row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-02 5V0 5V0 Supply through input poly fuse - -
P1-04 5V0 5V0 Supply through input poly fuse - -
P1-06 GND GND - - -
P1-08 GPIO 14 GPIO 14 Boot to Alt 0 -> UART0_TXD ALT5 = UART1_TXD
P1-10 GPIO 15 GPIO 15 Boot to Alt 0 -> UART0_RXD ALT5 = UART1_RXD
P1-12 GPIO 18 GPIO 18 - PCM_CLK ALT4 = SPI1_CE0_N ALT5 = PWM0
P1-14 GND GND - - -
P1-16 GPIO23 GPIO23 - - ALT3 = SD1_CMD ALT4 = ARM_RTCK
P1-18 GPIO24 GPIO24 - - ALT3 = SD1_DAT0 ALT4 = ARM_TDO
P1-20 GND GND - - -
P1-22 GPIO25 GPIO25 - - ALT3 = SD1_DAT1 ALT4 = ARM_TCK
P1-24 GPIO08 GPIO08 - SPI0_CE0_N -
P1-26 GPIO07 GPIO07 - SPI0_CE1_N -

P1 Header Pinout, bottom row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-01 3v3 3v3 50 mA max (01 & 17) - -
P1-03 GPIO 0 GPIO 2 1K8 pull up resistor I2C0_SDA / I2C1_SDA -
P1-05 GPIO 1 GPIO 3 1K8 pull up resistor I2C0_SCL / I2C1_SCL -
P1-07 GPIO 4 GPIO 4
GPCLK0 ALT5 = ARM_TDI
P1-09 GND GND - - -
P1-11 GPIO17 GPIO17 - - ALT3 = UART0_RTS ALT4 = SPI1_CE1_N ALT5 = UART1_RTS
P1-13 GPIO21 GPIO27 - PCM_DOUT / reserved ALT4 = SPI1_SCLK ALT5 = GPCLK1 / ALT3 = SD1_DAT3 ALT4 = ARM_TMS
P1-15 GPIO22 GPIO22 -
ALT3 = SD1_CLK ALT4 = ARM_TRST
P1-17 3v3 3v3 50 mA max (01 & 17) - -
P1-19 GPIO10 GPIO10 - SPI0_MOSI -
P1-21 GPIO9 GPIO9 - SPI0_MISO -
P1-23 GPIO11 GPIO11 - SPI0_SCLK -
P1-25 GND GND - - -

Notes: The maximum current capable of being sourced from P1 pins 1 and 17 is 50mA in total. That is the current drawn from both pins, not 50mA each.

Additional Pins on the Model B+

P1 Header Pinout, top row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-28 ID_SC ID_SC ? - -
P1-30 GND GND - - -
P1-32 GPIO12 GPIO12 - - -
P1-34 GND GND - - -
P1-36 GPIO16 GPIO16 - - -
P1-38 GPIO20 GPIO20 - - -
P1-40 GPIO21 GPIO21 - - -

P1 Header Pinout, bottom row:

Pin Number Pin Name Rev1 Pin Name Rev2 Hardware Notes Alt 0 Function Other Alternative Functions
P1-27 ID_SD ID_SD ? - -
P1-29 GPIO5 GPIO5 - - -
P1-31 GPIO6 GPIO6 - - -
P1-33 GPIO13 GPIO13 - - -
P1-35 GPIO19 GPIO19 - - -
P1-37 GPIO26 GPIO26 - - -
P1-39 GND GND - - -

Notes: There are currently no split revisions for the Model B+. I have simply put the same thing in both columns.

At the time of writing I don't know what the alternative functions for the additional GPIO pins are, if any.

It is recommended that you do not attempt to plug a twenty-six way IDC connector onto the forty pin GPIO bus of a new Model B+. This is because the plastic at the ends of an IDC plug is thick enough to bend the first two pins which are beyond the plug. No doubt traders will very quickly make forty-way IDC plugs and ribbon cables available.

Thanks to John Wash of the Surrey Linux user group for helping me by looking at the published diagram.