Which pins are safe to use on ESP32? (pinout basics)
ESP32 boards have lots of GPIO pins, but not all pins behave the same. Some are input-only, some are used at boot, and some are connected to on-board flash depending on the module.
Simple rules that prevent most problems
- Start with pins labeled GPIO on your board's pinout. Do not guess from random diagrams.
- Avoid wiring to boot strap pins until you know what you are doing. Bad pull-ups/pull-downs can stop the board from booting.
- Remember input-only pins. Some ESP32 pins can read inputs but cannot drive outputs.
Input-only pins
On classic ESP32, GPIO34 to GPIO39 are typically input-only. Great for sensors, not for LEDs or relays.
Pins that can affect boot
Some pins are sampled during boot to choose modes. If you connect a module that forces one of these pins high/low, the ESP32 may fail to boot or fail to upload.
If uploads are flaky, disconnect external wiring and try uploading with only USB connected.
Best practice
- Use your exact board's pinout (the same dev kit can be wired differently across clones).
- Test with a simple sketch first (blink or serial print) before adding lots of peripherals.
- Keep wires short and share a common ground.
Use your board's pinout, prefer known-safe GPIO pins, and be careful with boot-related pins. If the ESP32 will not upload, disconnect external wiring and try again.
Related: What does "Failed to connect to ESP32" mean? · What are I2C, SPI, and UART, and which one should I use? · 3.3V vs 5V: can I connect this sensor/module?