Back to Tools

ESP32, Arduino and Raspberry Pi Pinouts

Interactive pin diagrams for the ESP32 DevKitC, Arduino Uno and Nano, Raspberry Pi Pico and the Raspberry Pi 40-pin header, checked pin by pin against the official documents. Hover a pin to see what it can do and what to avoid.

Raspberry Pi pinout: the 40-pin GPIO header

The same 40-pin header sits on every Raspberry Pi from the B+ on: Pi 2, 3, 4, 5, 400/500 and all Zero models. Code uses the GPIO (BCM) numbers, which don't match the physical pin numbers: GPIO17 is pin 11.

Raspberry Pi 40-pin GPIO header13V325V3GPIO245V5GPIO36GND7GPIO48GPIO149GND10GPIO1511GPIO1712GPIO1813GPIO2714GND15GPIO2216GPIO23173V318GPIO2419GPIO1020GND21GPIO922GPIO2523GPIO1124GPIO825GND26GPIO727GPIO028GPIO129GPIO530GND31GPIO632GPIO1233GPIO1334GND35GPIO1936GPIO1637GPIO2638GPIO2039GND40GPIO21

Pin 1 (3V3) at the top. Odd pins on the left, even pins on the right along the board edge. On a Pi with the header along its top edge, pin 1 is the bottom-left pin.

Key facts: Raspberry Pi 40-pin GPIO header

Logic level
3.3 V. The GPIO pins are not 5 V tolerant.
Current per pin
Up to 16 mA per pin.
Total current
50 mA for all GPIO pins combined.
Power pins
Two 5 V (pins 2, 4), two 3.3 V (pins 1, 17) and eight ground pins.
Models
The functions shown work on Pi 2, 3, 4, 5 and Zero. The Pi 4 and 5 add more UART, I2C and SPI buses on other pins, and the Pi 5 can also put hardware PWM on GPIO14 and GPIO15.

Pins to avoid or treat with care

  • 5 V on any GPIO pin: it destroys the processor.
  • Pins 27 and 28 (GPIO0, GPIO1): reserved for HAT ID EEPROMs.
  • More than 16 mA from one pin or 50 mA from all of them: drive motors and relays through a transistor or driver.
  • Pull-downs on GPIO2 and GPIO3: they have fixed 1.8 kΩ pull-ups.

Raspberry Pi 40-pin GPIO header pin table

40 of 40 pins
All pins of the Raspberry Pi 40-pin GPIO header
PositionPinIn codeFunctionsNotes
Pin 1––3.3 V output for sensors and other low-current parts. Raspberry Pi's documentation gives no current limit for these pins; budget conservatively.
Pin 2––Connected to the Pi's 5 V supply. It can power 5 V parts, or power the Pi itself (a PoE+ HAT does this). Never connect it to a GPIO pin.
Pin 3GPIO2I2C1 SDAHas a fixed 1.8 kΩ pull-up to 3.3 V on the board, so it reads high when nothing is connected and can't use a pull-down.
Pin 4––Connected to the Pi's 5 V supply. It can power 5 V parts, or power the Pi itself (a PoE+ HAT does this). Never connect it to a GPIO pin.
Pin 5GPIO3I2C1 SCLHas a fixed 1.8 kΩ pull-up to 3.3 V on the board, so it reads high when nothing is connected and can't use a pull-down.
Pin 6––
Pin 7GPIO4–GPCLK0
Pin 8GPIO14UART TX (TXD)
Pin 9––
Pin 10GPIO15UART RX (RXD)
Pin 11GPIO17SPI1 CE1
Pin 12GPIO18PWM0, SPI1 CE0PCM_CLKHardware PWM channel 0, the same channel as GPIO12 on a Pi 4 and earlier.
Pin 13GPIO27–
Pin 14––
Pin 15GPIO22–
Pin 16GPIO23–
Pin 17––3.3 V output for sensors and other low-current parts. Raspberry Pi's documentation gives no current limit for these pins; budget conservatively.
Pin 18GPIO24–
Pin 19GPIO10SPI0 MOSI
Pin 20––
Pin 21GPIO9SPI0 MISO
Pin 22GPIO25–
Pin 23GPIO11SPI0 SCLK
Pin 24GPIO8SPI0 CE0
Pin 25––
Pin 26GPIO7SPI0 CE1
Pin 27GPIO0ID_SD (I2C0 SDA)HAT IDReserved for the ID EEPROM on HAT boards: the Pi reads it at boot to identify the HAT. Leave it unconnected unless you are building a HAT with an ID EEPROM.
Pin 28GPIO1ID_SC (I2C0 SCL)HAT IDReserved for the ID EEPROM on HAT boards: the Pi reads it at boot to identify the HAT. Leave it unconnected unless you are building a HAT with an ID EEPROM.
Pin 29GPIO5–GPCLK1
Pin 30––
Pin 31GPIO6–GPCLK2
Pin 32GPIO12PWM0
Pin 33GPIO13PWM1
Pin 34––
Pin 35GPIO19PWM1, SPI1 MISOPCM_FSHardware PWM channel 1, the same channel as GPIO13 on a Pi 4 and earlier.
Pin 36GPIO16SPI1 CE2
Pin 37GPIO26–
Pin 38GPIO20SPI1 MOSIPCM_DIN
Pin 39––
Pin 40GPIO21SPI1 SCLKPCM_DOUT

Sources for the Raspberry Pi 40-pin GPIO header

How to read these pin diagrams

Every board is drawn from the top, the way you see it on the bench, with the pins in their real order. Red pins are power, black are ground, grey are control pins such as reset, and green are general-purpose I/O. A yellow ring marks a pin with a catch: a strapping pin that changes how the chip boots, a pin wired to flash or USB, or an input-only pin.

Pick a function above the drawing (I2C, SPI, ADC…) to light up the pins that can do it and see each pin's name for that function. Pins marked default are the ones the board's own documentation uses; on the ESP32 and the Pico most peripherals can move to other pins in software.

The label printed on the board, the physical pin number and the number you type in code are often three different things. On a Raspberry Pi, physical pin 11 is GPIO17. On an ESP32 the board says IO32 and the code says 32. The table under each drawing lists all three.

3.3 V or 5 V: logic levels and current limits

BoardLogic level5 V on a GPIO?Current per pinAll pins together
ESP32-DevKitC3.3 VNo (3.6 V max)~20 mA default, ~40 mA max drive1,200 mA (abs. max)
Arduino Uno R3, Nano5 VYes20 mA (40 mA abs. max)200 mA (abs. max)
Raspberry Pi Pico3.3 VNo2–12 mA, 4 mA default50 mA
Raspberry Pi (40-pin header)3.3 VNo16 mA50 mA

The ESP32, the Pico and the Raspberry Pi run their pins at 3.3 V and none of them is 5 V tolerant. A 5 V sensor output on one of their GPIOs needs a level shifter or a resistor divider. The Arduino Uno and Nano run at 5 V; most 3.3 V modules need their inputs shifted down when you connect them to an Arduino.

The current limits are for the I/O pins, not for driving motors or relays. A small indicator LED is fine on any of these boards with a series resistor that keeps it under the pin's limit; anything bigger goes through a transistor or a driver. The LED resistor calculator works out the resistor.

Questions people ask

Which ESP32 pins are safe to use?
On an ESP32-DevKitC with a WROOM module, GPIO4, 13, 14, 16–19, 21–23, 25–27, 32 and 33 are full input/output pins with no boot role. GPIO34–39 are fine as inputs. Leave GPIO6–11 alone (flash), keep GPIO1 and 3 for USB serial, and check what your circuit does to GPIO0, 2, 5, 12 and 15 at reset.
Why won't my ESP32 boot or upload?
Usually a strapping pin. GPIO0 pulled low at reset starts the bootloader instead of your program. GPIO12 pulled high switches the flash to 1.8 V. GPIO2 pulled high stops the board entering download mode. Move whatever is on those pins, or make sure it doesn't pull them the wrong way while the board resets.
Can I use ADC2 with Wi-Fi on?
No. The ESP32's Wi-Fi driver uses ADC2, so readings from ADC2 pins (GPIO0, 2, 4, 12–15, 25–27) fail while Wi-Fi is running. Use the ADC1 pins: GPIO32–36 and 39.
Is the ESP32-S3 or ESP32-C3 pinout the same?
No. The S3 and C3 are different chips with different GPIO numbers, ADC channels and strapping pins, and their dev boards have their own layouts. Don't use the ESP32 pinout above for them; use Espressif's guide for your exact board.
Which Arduino Uno pins are PWM?
Pins 3, 5, 6, 9, 10 and 11, marked with a ~ on the board. They run at about 490 Hz, except 5 and 6 at about 980 Hz. The same pins are PWM on the Nano.
Which pins are interrupts on an Uno or Nano?
attachInterrupt() works on pins 2 and 3 (INT0 and INT1). D0 to D13 and A0 to A5 also have pin-change interrupts (PCINT), which attachInterrupt() doesn't use.
What are A6 and A7 on the Nano?
Two extra analog inputs the Uno doesn't have. They are analog only: analogRead() works, but digitalRead(), digitalWrite() and pinMode() don't, and there is no pull-up.
Are Raspberry Pi GPIO pins 5 V tolerant?
No. Raspberry Pi GPIO pins are 3.3 V only, and 5 V on one can permanently damage the processor. The two 5V pins on the header are power pins, not signals.
Raspberry Pi: physical pin numbers or GPIO numbers?
Code uses the GPIO numbers (also called BCM numbers), such as GPIO17. The physical numbers 1 to 40 count across the header, odd pins on one row and even on the other, starting at the 3.3 V pin. GPIO17 is physical pin 11.
Does the Raspberry Pi Pico 2 have the same pinout?
The header layout and the power pins are the same. The chip is the RP2350 instead of the RP2040, with different electrical limits, so check the Pico 2 datasheet before relying on the numbers on this page.

Related tools and guides

Describe a circuit. Get a board you can order.

GrandpaCAD's chat picks real parts, draws the schematic, routes the PCB and checks it against JLCPCB's rules. You get Gerbers, BOM, pick-and-place, a KiCad project and a 3D board, plus a printed case if you want one.

"Raspberry Pi HAT with a real-time clock and a fan header"

3 free generations, no card required