Aziz Bench

ESP32 pinout: which GPIO pins are safe to use

Tap a pin to see what it can do and what to watch out for. Then list the pins your project uses: the planner flags strapping pins, input-only GPIOs and ADC2 pins that stop working with Wi-Fi.

Raspberry Pi Pico pinout →
  • Free to use
  • Use with care
  • Input only
  • Do not use
  • Power and control
Project

ADC2 pins stop working while Wi-Fi is on.

Add pin

My pin plan

    No pins yet. Pick a pin on the map, or add one with the form.

    Ready to paste at the top of a sketch or in an issue.

    The pins to avoid or handle with care

    The ESP32 has 34 GPIOs, but on a DevKit only about two thirds of them behave like plain pins. Four groups need attention.

    GPIO 6 to 11: taken by the flash

    These six pins connect the chip to the SPI flash inside the module. DevKitC boards bring them out as CLK, SD0, SD1, SD2, SD3 and CMD, but touching them crashes the program or stops the board from booting.

    GPIO 0, 2, 5, 12 and 15: strapping pins

    The chip reads these pins at reset to decide how to start. Once the program runs they are normal GPIOs, so they work well as outputs or for buttons. Trouble comes from anything that forces the wrong level at power-up, such as a pull-up resistor, a module that drives the line or a sensor that holds it.

    GPIODefault at resetWhat it selectsIn practice
    0Pull-up (HIGH)Boot mode: HIGH runs the program, LOW enters download modeNothing may hold it LOW at power-up
    2Pull-down (LOW)Must be LOW or floating for download modeNo pull-up; often the onboard LED
    5Pull-up (HIGH)SDIO slave timing, with GPIO15Safe for most uses
    12Pull-down (LOW)Flash voltage: LOW 3.3 V, HIGH 1.8 VNever pull HIGH at reset
    15Pull-up (HIGH)Boot log on UART0: HIGH prints it, LOW silences itSafe; LOW only hides the log

    GPIO 34 to 39: input only

    These pins have no output driver and no internal pull-up or pull-down. They are a good place for analog readings and buttons with an external resistor. They can’t drive an LED, a relay or a bus line. GPIO 37 and 38 exist on the chip but are not brought out on WROOM modules.

    GPIO 1 and 3: the USB serial port

    UART0 runs to the USB-serial chip and carries both uploads and Serial. You can reuse these pins in a finished project, but you lose the serial monitor and uploads can fail while something is connected.

    ADC2 stops working when Wi-Fi is on

    The ESP32 has two ADCs. ADC1 is on GPIO 32 to 39, ADC2 on GPIO 0, 2, 4, 12 to 15 and 25 to 27. The Wi-Fi driver uses ADC2, so as soon as Wi-Fi starts, reads on those pins fail or return garbage. In a connected project, put every analog input on ADC1. Measuring a battery? GPIO 34 or 35 with a resistor divider is the usual choice.

    Even on ADC1 the readings are not linear near the ends of the range. With 12 dB attenuation Espressif recommends staying roughly between 0.15 V and 2.45 V for accurate results, so size the divider to keep the signal in that window.

    Full ESP32 GPIO table

    GPIOStatusADCTouchRTCNotes
    GPIO0Use with careADC2_CH1T1RTC_GPIO11strapping
    GPIO1 (TX)Use with care———USB serial, UART0 TX
    GPIO2Use with careADC2_CH2T2RTC_GPIO12strapping, LED on some boards
    GPIO3 (RX)Use with care———USB serial, UART0 RX
    GPIO4Free to useADC2_CH0T0RTC_GPIO10—
    GPIO5Use with care———strapping, VSPI SS
    GPIO6 (CLK)Do not use———SPI flash
    GPIO7 (SD0)Do not use———SPI flash
    GPIO8 (SD1)Do not use———SPI flash
    GPIO9 (SD2)Do not use———SPI flash
    GPIO10 (SD3)Do not use———SPI flash
    GPIO11 (CMD)Do not use———SPI flash
    GPIO12Use with careADC2_CH5T5RTC_GPIO15strapping, HSPI MISO
    GPIO13Free to useADC2_CH4T4RTC_GPIO14HSPI MOSI
    GPIO14Free to useADC2_CH6T6RTC_GPIO16may be active at boot, HSPI SCK
    GPIO15Use with careADC2_CH3T3RTC_GPIO13strapping, HSPI SS
    GPIO16Free to use———PSRAM on WROVER, RX2/TX2 on some boards
    GPIO17Free to use———PSRAM on WROVER, RX2/TX2 on some boards
    GPIO18Free to use———VSPI SCK
    GPIO19Free to use———VSPI MISO
    GPIO21Free to use———I2C SDA
    GPIO22Free to use———I2C SCL
    GPIO23Free to use———VSPI MOSI
    GPIO25Free to useADC2_CH8—RTC_GPIO6—
    GPIO26Free to useADC2_CH9—RTC_GPIO7—
    GPIO27Free to useADC2_CH7T7RTC_GPIO17—
    GPIO32Free to useADC1_CH4T9RTC_GPIO932 kHz crystal
    GPIO33Free to useADC1_CH5T8RTC_GPIO832 kHz crystal
    GPIO34Input onlyADC1_CH6—RTC_GPIO4input only
    GPIO35Input onlyADC1_CH7—RTC_GPIO5input only
    GPIO36 (VP)Input onlyADC1_CH0—RTC_GPIO0input only
    GPIO39 (VN)Input onlyADC1_CH3—RTC_GPIO3input only

    RTC pins can wake the chip from deep sleep (ext0 for one pin, ext1 for a group), and touch pins can wake it with a touch. Default roles are the ones used by Arduino-ESP32: Wire on 21/22, SPI (VSPI) on 18/19/23/5. Serial2’s default pins changed in core 3.x, so pass them explicitly.

    Frequently asked questions

    Which ESP32 pins are safe to use?

    On a DevKit the GPIOs without restrictions are 4, 13, 14, 16 to 19, 21 to 23, 25 to 27, 32 and 33. GPIO 34 to 39 are fine as inputs. GPIO 0, 2, 5, 12 and 15 work once the program runs but decide how the chip boots, and GPIO 6 to 11 belong to the flash. On WROVER modules GPIO 16 and 17 are taken by the PSRAM.

    Can I use ADC2 pins with Wi-Fi?

    No. The Wi-Fi driver uses ADC2, so analog reads on GPIO 0, 2, 4, 12 to 15 and 25 to 27 fail while Wi-Fi is on. Use the ADC1 pins, GPIO 32 to 39. ADC2 works again only when Wi-Fi is stopped.

    Why doesn’t my ESP32 boot after I connected something to GPIO12?

    GPIO12 sets the flash voltage at reset. If a pull-up or a connected module holds it HIGH, the chip powers the flash at 1.8 V and modules with 3.3 V flash fail to start. Move the connection to another pin, or burn the flash voltage into the eFuses with espefuse set-flash-voltage 3.3V. That last step is permanent and can’t be undone.

    Which pins can wake the ESP32 from deep sleep?

    The RTC GPIOs: 0, 2, 4, 12 to 15, 25 to 27 and 32 to 39. Use ext0 to wake on one pin and ext1 to wake on a group of pins. Touch pins can also wake the chip with a touch.

    What are the default I2C and SPI pins on the ESP32?

    In Arduino-ESP32, Wire uses GPIO 21 for SDA and 22 for SCL, and SPI uses the VSPI pins: 18 SCK, 19 MISO, 23 MOSI and 5 SS. Thanks to the GPIO matrix you can move them to almost any pin that supports output by passing the pins to Wire.begin() or SPI.begin().

    Are ESP32 pins 5 V tolerant?

    No. The GPIOs work at 3.3 V and Espressif does not rate them for 5 V. Connect 5 V signals through a level shifter or a resistor divider.