The Raspberry Pi 4 Model B (powered by the BCM2711 SoC) features a 40-pin GPIO header that serves as the physical bridge between your software and the real world. However, unlike microcontrollers with 5V-tolerant pins, the Pi 4 operates strictly at 3.3V logic. Feeding 5V into a standard GPIO pin will instantly destroy the SoC. Below is the complete, decision-forward reference for Raspberry Pi 4 pinouts, assuming a standard 40-pin header orientation with the board facing up and the USB ports pointing toward you.

The Complete Raspberry Pi 4 Pinouts Reference Table

Read this table looking from the top down, with Pin 1 (3V3) at the top left, closest to the SD card slot. Pins are grouped by physical location to match your physical wiring workflow.

Pin Function (Left Row) Function (Right Row) Pin
13V3 Power5V Power2
3GPIO 2 (SDA1 / I2C)5V Power4
5GPIO 3 (SCL1 / I2C)Ground6
7GPIO 4 (GPCLK0)GPIO 14 (TXD / UART)8
9GroundGPIO 15 (RXD / UART)10
11GPIO 17GPIO 18 (PWM0 / PCM_CLK)12
13GPIO 27Ground14
15GPIO 22GPIO 2316
173V3 PowerGPIO 2418
19GPIO 10 (MOSI / SPI0)Ground20
21GPIO 9 (MISO / SPI0)GPIO 2522
23GPIO 11 (SCLK / SPI0)GPIO 8 (CE0 / SPI0)24
25GroundGPIO 7 (CE1 / SPI0)26
27GPIO 0 (ID_SD / EEPROM)GPIO 1 (ID_SC / EEPROM)28
29GPIO 5Ground30
31GPIO 6GPIO 12 (PWM0)32
33GPIO 13 (PWM1)Ground34
35GPIO 19 (MISO / SPI1)GPIO 16 (CE2 / SPI1)36
37GPIO 26GPIO 20 (MOSI / SPI1)38
39GroundGPIO 21 (SCLK / SPI1)40

Source: Pinout.xyz and the Raspberry Pi Foundation.

Rows People Get Wrong (And How to Avoid Bricking Your Pi)

Misinterpreting the Raspberry Pi 4 pinouts is the leading cause of dead boards on the workbench. Here are the specific rows that trap hobbyists and trade students:

WARNING: The 5V vs 3.3V Trap
Pins 2 and 4 output 5V from the USB-C power supply. Pins 1 and 17 output 3.3V from the onboard regulator. Never wire a 5V sensor output directly to any GPIO pin (Pins 3-40, excluding power). If you are interfacing a 5V Arduino or a 5V industrial sensor, you must use a bidirectional logic level shifter (like the TXS0108E or a BSS138 MOSFET circuit) to step the signal down to 3.3V.
  • Pins 27 & 28 (GPIO 0 & 1): These are reserved for the HAT (Hardware Attached on Top) ID EEPROM. They have specific pull-up/pull-down states during boot to identify attached boards. Do not use these for general I/O or your Pi may fail to boot or misconfigure the device tree.
  • Pins 3 & 5 (GPIO 2 & 3 / I2C): These pins have onboard 1.8kΩ pull-up resistors tied to 3.3V. If you are wiring an I2C sensor, do not add external pull-up resistors on your breadboard, as paralleling them will lower the resistance, increase the I2C bus capacitance, and corrupt your data packets.
  • Ground Pins (6, 9, 14, 20, 25, 30, 34, 39): While all grounds are electrically common, use the ground pins physically closest to your active signal pins to minimize loop area and reduce electromagnetic interference (EMI), especially for high-speed SPI or analog sensor returns.

Wiring Color Codes & Ribbon Cable Standards

Unlike mains wiring governed by NEC or IEC standards, low-voltage DC embedded wiring relies on industry conventions. Adhering to these prevents catastrophic miswiring when you return to a project months later.

Discrete Jumper Wires (Dupont Style)

  • Red: 5V Power (Pins 2, 4)
  • Orange: 3.3V Power (Pins 1, 17)
  • Black: Ground (Any GND pin)
  • Yellow/Green/Blue: Signals (GPIO, SDA, SCL, MOSI, MISO)

Ribbon Cables & Regional Variants

When using a 40-pin IDC ribbon cable to route GPIO to a breakout board, the red stripe on the cable universally denotes Pin 1. However, if you are adapting older UK or legacy telecom ribbon standards where the stripe might be blue or green, always verify Pin 1 with a multimeter before applying power. In standard IEC 60446 DC wiring, brown is positive and blue is negative, but in the Pi ecosystem, the physical Pin 1 square pad is your only absolute truth.

Protocol Decision Tree: Which Pins Should You Use?

Don't just pick random GPIO numbers. Use this decision path to select the correct hardware-backed pins for your specific sensor or actuator.

If your project requires... Choose this Protocol Concrete Pin Pick Why this pick?
Multiple slow sensors (temp, humidity, IMU) on the same bus I2C GPIO 2 (SDA) & GPIO 3 (SCL) Hardware I2C1 bus with built-in 1.8k pull-ups. Supports up to 127 addresses.
High-speed data (ADC, DAC, TFT displays, SD cards) SPI0 GPIO 9, 10, 11 + GPIO 8 (CE0) Hardware SPI0 supports up to 125MHz. GPIO 8 is Chip Enable 0.
Smooth motor control, LED dimming, or servo steering Hardware PWM GPIO 18 GPIO 18 is the most reliable hardware PWM pin (PWM0) with minimal audio interference compared to GPIO 12/13.
GPS modules, serial consoles, or ESP32 bridging UART GPIO 14 (TX) & GPIO 15 (RX) Hardware UART0. Note: You must disable the serial console in raspi-config to free these pins for user data.
Pro-Tip: The 16mA Limit
The BCM2711 GPIO pins default to an 8mA drive strength and can be configured up to 16mA per pin. The absolute maximum current draw across all GPIO pins combined is 50mA. If you are driving relays or high-power LEDs, you must use a transistor (like a 2N2222) or a MOSFET (like an IRLZ44N) to switch the load, using the Pi pin only to trigger the gate/base.

Safe Interpretation When Markings Are Faded or Missing

On older Pi 4 boards, or boards deployed in harsh industrial enclosures, the silkscreen pin labels can wear off or become obscured by dust and conformal coating. Never guess the pinout based on memory.

  1. Locate Pin 1 Physically: Flip the board over or look closely at the header. Pin 1 is the only pin with a square copper pad on the PCB; all other pins have round pads. On the Pi 4, Pin 1 is also physically closest to the microSD card slot and the USB-C power connector.
  2. Verify Power Rails: Before connecting any logic, power the board and use a multimeter. Place the black probe on the metal shield of the USB ports (which is tied to ground) and use the red probe to verify 5V on Pins 2/4 and 3.3V on Pins 1/17.
  3. Identify Grounds: With the board powered off, set your multimeter to continuity mode. Touch one probe to the USB shield and probe the header. Any pin that beeps is a valid Ground pin. This safely maps out Pins 6, 9, 14, 20, 25, 30, 34, and 39 without relying on faded ink.

By treating the Raspberry Pi 4 pinouts as a strict hardware contract rather than a suggestion, you eliminate the most common points of failure in embedded prototyping. Stick to the hardware-backed buses, respect the 3.3V logic ceiling, and your BCM2711 will survive your learning curve.