The Raspberry Pi 40-pin header provides 26 usable GPIOs, 4 power pins, and 8 ground pins. All logic operates at 3.3V. Feeding 5V into a standard GPIO will permanently destroy the Broadcom SoC. Software defaults to BCM (Broadcom) numbering, while physical wiring relies on Physical Pin numbering (1-40). Pin 1 is always the 3.3V power rail, located on the top-left when the board is oriented with the USB ports facing you and the GPIO header on the top-right edge.
The 40-Pin GPIO Raspberry Pi Pinout Table
Below is the essential subsystem map for the 40-pin header. While the board has 40 physical pins, most projects rely on the power rails and the default alternate functions (I2C, SPI, UART) listed here. Read the left column for the physical pin number (used in hardware wiring and RPI.GPIO physical mode) and the right column for the BCM number (used in Python gpiozero and RPi.GPIO BCM mode).
| Physical Pin | Function / BCM | Direction / Notes | Physical Pin | Function / BCM | Direction / Notes |
|---|---|---|---|---|---|
| 1 | 3.3V Power | Max 50mA total draw | 2 | 5V Power | Direct from USB-C/5V rail |
| 3 | GPIO 2 (SDA1) | I2C Data (1.8k pull-up) | 4 | 5V Power | Direct from USB-C/5V rail |
| 5 | GPIO 3 (SCL1) | I2C Clock (1.8k pull-up) | 6 | Ground (GND) | Common return path |
| 7 | GPIO 4 (GPCLK0) | General Purpose Clock | 8 | GPIO 14 (TXD) | UART Transmit (3.3V) |
| 9 | Ground (GND) | Common return path | 10 | GPIO 15 (RXD) | UART Receive (3.3V) |
| 11 | GPIO 17 | Standard GPIO | 12 | GPIO 18 (PWM0) | Hardware PWM capable |
| 19 | GPIO 10 (MOSI) | SPI0 Master Out | 20 | Ground (GND) | Common return path |
| 21 | GPIO 9 (MISO) | SPI0 Master In | 22 | GPIO 25 | Standard GPIO |
| 23 | GPIO 11 (SCLK) | SPI0 Clock | 24 | GPIO 8 (CE0) | SPI0 Chip Select 0 |
| 25 | Ground (GND) | Common return path | 26 | GPIO 7 (CE1) | SPI0 Chip Select 1 |
For the complete 40-pin map including the ID EEPROM pins (27/28) and secondary SPI/I2C interfaces, refer to the official Raspberry Pi Pinout interactive guide.
What These Rows Mean in Practice
The most critical takeaway from this table is the distinction between power rails and logic pins. Pins 1 and 17 provide 3.3V, while Pins 2 and 4 provide 5V. The 3.3V pins are regulated and should be used to power low-draw sensors (like a BME280 or an ESP-01). The 5V pins are tied directly to the USB-C input; if your Pi is powered by a 5.1V supply, these pins will output 5.1V.
The 3.3V regulator on the Pi can only supply a limited amount of current to the GPIO header (typically around 50mA to 80mA depending on the board revision and internal SoC draw). If you need to power a string of NeoPixels or a relay module, pull power from the 5V pins and use a dedicated logic-level converter or buck converter.
Numbering Standards and DC Wiring Color Codes
When wiring a Pi, you are bridging the gap between embedded software conventions and physical electrical standards. Understanding which numbering scheme and wire color standard applies to your build prevents catastrophic miswiring.
Software Numbering: BCM vs. Physical vs. WiringPi
- BCM (Broadcom SOC channel): The modern standard. Maps directly to the Broadcom chip's internal GPIO registers. Pin 3 on the header is BCM 2. Use this for all new Python/C++ projects.
- Physical (Board): Simply counts the pins 1 through 40. Ideal for hardware debugging and beginners using a physical pinout diagram.
- WiringPi: A legacy numbering scheme created by Gordon Henderson. It is deprecated and largely unsupported on the Pi 4 and Pi 5. Avoid it in 2026.
Wire Color Standards: Industrial vs. Hobbyist
While the Raspberry Pi Foundation does not mandate wire colors for GPIO headers, adopting a strict color code prevents faults when scaling from a breadboard to a permanent enclosure. Here is how regional and industrial standards dictate DC control wiring:
| Standard / Region | DC Positive (+) | DC Negative / GND (-) | Signal / Control | Application Context |
|---|---|---|---|---|
| Hobbyist / Adafruit | Red | Black | Yellow / Blue / Green | Breadboards, dupont cables, quick prototypes. |
| IEC 60204-1 (EU/Global Industrial) | Brown | Blue | Black (or Red for switched) | Industrial control panels, DIN-rail PLC wiring. |
| NEC Article 409/725 (US Industrial) | Red (or Brown) | Black (or Blue) | Orange / Yellow | US industrial control cabinets, Class 2 circuits. |
| Legacy UK Telecom (Pre-2004) | Red | Black | Green / Yellow | Rarely used today, but found in old alarm systems. |
Which standard applies to you? If you are building a home automation node in a plastic enclosure, the Hobbyist (Red/Black) standard is universally understood by the maker community. If you are mounting the Pi in an industrial control cabinet alongside 24V PLCs, you must follow IEC 60204-1 or NEC Article 409 to pass inspection and prevent maintenance technicians from confusing your 5V Pi rail with a 24VDC industrial rail.
Rows People Get Wrong (and How to Avoid Them)
Even experienced engineers brick their Pis by overlooking the specific electrical characteristics of certain header pins. Here are the most common failure modes.
1. The I2C Pull-Up Trap (Pins 3 and 5)
Physical pins 3 (SDA) and 5 (SCL) are hardwired to the 3.3V rail through 1.8kΩ pull-up resistors on the Pi PCB. If you connect a 5V I2C sensor module that also has its own 4.7kΩ pull-ups to 5V, you create a voltage divider that will push the voltage on the Pi's I2C pins above 3.3V, potentially damaging the SoC over time. Fix: Always use a dedicated I2C level shifter (like the BSS138-based Adafruit 4-channel shifter) when connecting 5V I2C devices.
2. UART Voltage Mismatch (Pins 8 and 10)
Pins 8 (TX) and 10 (RX) operate at 3.3V logic. A common mistake is connecting these directly to the TX/RX pins of an Arduino Uno or a 5V FTDI adapter. The 5V TX line from the external device will backfeed 5V into the Pi's RX pin (Physical 10). Fix: Use a logic level converter, or use a 1kΩ/2kΩ resistor voltage divider on the line feeding INTO the Pi's RX pin.
3. LED Current Limiting Math
Connecting an LED directly to a GPIO pin without a resistor will draw excessive current. The absolute maximum current per GPIO pin is 16mA, and the total bank limit is 50mA. Let's calculate the correct resistor for a standard red LED (Forward Voltage = 2.0V, Target Current = 10mA):
R = (V_source - V_LED) / I
R = (3.3V - 2.0V) / 0.010A = 130Ω
The nearest standard E12 resistor value is 150Ω. Always use 150Ω or higher for 3.3V GPIO LEDs.
Safe Interpretation When Markings are Faded or Missing
On older Pi models, or when using a Pi Zero / Compute Module where headers are soldered manually, the silkscreen pin numbers are often obscured by flux residue, scratched off, or entirely absent. Guessing the pinout will result in a dead board. Follow this verification protocol.
Identifying Pin 1 Without Silkscreen
- The Square Pad Rule: Look closely at the solder joints on the underside of the board (or the top if using a pin header). Pin 1 is always indicated by a square solder pad. All other pins (2 through 40) have round solder pads.
- The Edge Proximity Rule: Pin 1 is always the pin closest to the edge of the PCB and the SD card slot / USB-C power connector. It is never on the interior side of the header.
- The Component Orientation Rule: When the board is placed flat on a desk with the GPIO header on the top-right edge, Pin 1 is the top-left pin of the 2x20 grid.
Multimeter Verification Protocol
Before connecting any expensive sensor or HAT to an unverified header, use a digital multimeter (DMM) to map the power rails.
- Set your DMM to DC Voltage (20V range).
- Power the Pi via USB-C.
- Place the black probe on the metal shielding of the USB port or Ethernet jack (this is tied to system ground).
- Use the red probe to gently touch the suspected Pin 2 or 4. You should read between 4.9V and 5.2V.
- Move the red probe to the suspected Pin 1 or 17. You should read exactly 3.3V (±0.05V).
- Switch the DMM to Continuity mode (beep). With the Pi powered off, verify that your suspected Ground pins (6, 9, 14, 20, 25, 30, 34, 39) beep when probed against the USB shield.
By relying on physical pad geometry and multimeter verification rather than faded silkscreen, you eliminate the risk of backfeeding 5V into the 3.3V rail. For detailed schematic-level information on the Broadcom SoC alternate functions, consult the official Raspberry Pi hardware documentation.






