How to flash ESP32 firmware with esptool
Install esptool, pick the right chip and port, erase flash and write a .bin to an ESP32, ESP32-S3 or ESP32-C5 board from the command line.
Intermediate · about 7 min · Linux, Windows, macOS
esptool is the official command-line flasher for Espressif chips. It is the fallback whenever a browser installer stalls, and the only reliable route for newer targets such as the ESP32-C5. The whole job is three decisions: which chip, which serial port, which file — then one write_flash call.
What this guide covers
- Install esptool with pip
- Plug the board in with a data cable
- Confirm the chip esptool sees
- Erase the old flash contents
- Write the firmware image
- Windows: same command, COM port
- Newer targets: name the chip explicitly
- Watch it boot
Common pitfalls covered
- A charge-only USB cable enumerates no serial device at all — swap the cable before debugging drivers.
- On Linux your user must be in the … group, or every open fails with permission denied: …, then log out and back in.
- Boards without auto-reset need the BOOT button held while plugging in to enter download mode.
- 460800 baud fails on long or cheap cables — drop back to 115200 before assuming the board is dead.
- Writing an app-only image to 0x0 (or a merged image to 0x10000) produces an endless bootloader reset loop.
Questions answered
- Which offset should I flash an ESP32 .bin to?
- Why does esptool say 'Failed to connect to ESP32'?
- Do I need to erase flash before every update?
- Can I flash without installing Python?
This is a limited preview. The full walkthrough, command syntax and copy-ready examples are available to signed-in users.