ESP32 Factory Reset: Erase Flash with esptool
Erasing ESP32 flash removes firmware and saved application data. It does not repair damaged hardware or change the chip into a different model. First confirm the serial connection and keep the correct firmware ready to reinstall.
Quick checklist before erasing
- Back up data you need and check whether the application offers a less destructive settings reset.
- Identify the board, USB interface and serial port. Close serial monitors using that port.
- Use a data-capable USB cable and the board's documented power input.
- Check the installed esptool version before copying a command.
1. Install and identify esptool
python -m pip install esptool
python -m esptool version
On systems that use python3, substitute that executable. Run these commands in a terminal, not inside the Python interactive prompt. The commands below use esptool v5 spelling.
2. Select the port and enter download mode
Use the port shown when the board is connected. Boards with automatic reset may enter the bootloader during connection. If yours does not, follow its BOOT/RESET procedure. For a classic ESP32 board with manual buttons, hold BOOT, press and release RESET, then release BOOT once the tool connects. Other ESP families and native-USB boards can behave differently.
3. Erase the flash
Replace COM5 with your actual port. Proceed only when you intend to remove the installed application and stored data.
python -m esptool --port COM5 erase-flash
Older tutorials for esptool v4 often use erase_flash. Use the syntax documented for your installed major version. Do not mix commands from different tool versions.
4. Check the result and reinstall firmware
Confirm that the command reports successful completion, then flash firmware built for the exact board and flash layout. After a full erase, the old application cannot run; a boot message about missing or invalid firmware is not by itself evidence of a failed erase. Remove any temporary boot-mode jumper before normal operation.
Connection errors and next checks
| Symptom | What to check first |
|---|---|
| No serial data received / Failed to connect | Port, cable, download-mode procedure and power. |
| Port busy or permission denied | Close competing serial programs and check OS access to the port. |
| Transfer starts but stops | Cable quality, power stability and a lower baud rate. |
| Erase blocked on a secured device | The device's security configuration and vendor recovery procedure. Do not bypass safeguards or change eFuses as a generic fix. |
Frequently asked questions
Is RESET the same as erasing flash?
No. A reset normally restarts execution; erasing flash removes stored firmware and data.
Can erasing fix every board that will not upload?
No. The bootloader must communicate before an erase can run. Resolve power, wiring and connection problems first.
Related tutorials and hardware
- Firmware flashing guide
- USB & upload troubleshooting
- ESP32-CAM Won’t Upload? Board & Camera Troubleshooting
- ESP32 WROOM-32 Development Board TYPE-C CH340C/ CP2102 WiFi+Bluetooth Ultra-Low Power Consumption Dual Core Wireless Module
Reference images

Sources and version references
Choose the recovery task first
If esptool cannot connect, start with boot and USB troubleshooting; an erase command still needs a working connection. For a camera board, use the ESP32-CAM diagnostic sequence. Record the firmware source and configuration before erasing if the original application needs to be restored.
