This guide explains how esptool (Espressif's flashing tool) works under the hood, the differences between esptool.py and esptool-js, common commands, and how browser-based ESP flashing compares to traditional methods.
esptool.py is the official open-source Python tool from Espressif that communicates with the ESP32, ESP8266, and related chip ROM bootloaders. It handles the low-level serial protocol: baud rate synchronization, flash write with compression, MD5 verification, chip register access, and memory operations. Every flashing tool — Arduino IDE, PlatformIO, ESPHome, Tasmota web installer — ultimately relies on esptool under the hood.
| Feature | esptool.py | esptool-js (browser) |
|---|---|---|
| Language | Python 3.8+ | JavaScript (browser) |
| Installation | pip install esptool | None (included in ESP Flasher App) |
| Platform | Windows, macOS, Linux | Any with Chrome/Edge 89+ |
| Flash protocol | Full ROM bootloader protocol | Full ROM bootloader protocol |
| Compression | Yes | Yes |
| MD5 verification | Yes | Yes |
| Chip auto-detect | Yes | Yes |
When you flash firmware to an ESP32, the following sequence happens:
The entire process typically completes in 15-30 seconds for a 1-2 MB firmware at 921,600 baud.
esptool.py --port COM3 flash_id esptool.py --port COM3 read_mac esptool.py --port COM3 chip_id esptool.py --port COM3 erase_flash esptool.py --port COM3 write_flash 0x0 firmware.bin esptool.py --port COM3 read_flash 0x0 0x400000 backup.bin esptool.py --port /dev/ttyUSB0 merge_bin --output merged.bin 0x1000 boot.bin 0x8000 partitions.bin 0x10000 app.bin
| Chip | Bootloader | Partition Table | Application |
|---|---|---|---|
| ESP32 (classic) | 0x1000 | 0x8000 | 0x10000 |
| ESP32-S2 / S3 | 0x0 | 0x8000 | 0x10000 |
| ESP32-C3 / C6 / H2 | 0x0 | 0x8000 | 0x10000 |
| ESP8266 | 0x0 | N/A | 0x0 |
For a single merged/factory .bin file, always use address 0x0 regardless of chip.
ESP Flasher App implements the full esptool protocol in the browser using esptool-js. It provides all the essential functionality of esptool.py through a visual interface:
ESP32 supports hardware flash encryption (AES-XTS) and secure boot. When these features are enabled, firmware must be encrypted with the chip-specific key before flashing. The encryption is typically done in the build pipeline (esptool.py supports it via the --encrypt flag). ESP Flasher App supports flashing pre-encrypted .bin files at the correct address — the chip handles decryption transparently during boot.
ESP Flasher App — Browser-based ESP32 & ESP8266 firmware flashing tool