ESP32 Flash Size Calculator
Visualise how the ESP32 flash is split across the bootloader, partition table, NVS, OTA, SPIFFS/LittleFS, and app partitions. Helps you choose the right partition scheme for your firmware size.
Estimate a flash partition budget in MiB. Enter the sizes from your actual partition table; defaults are illustrative, not an ESP32 preset.
Estimated reserved
3.574 MiB
Unallocated
0.426 MiB
This is an arithmetic budget only; align it with a valid partition table.
Partition sizes and offsets must follow the ESP-IDF/Arduino framework’s valid alignment and partition-table rules. Confirm the real layout before flashing; a budget estimate does not generate a valid partition CSV.
How ESP32 flash is divided
The ESP32 stores everything in external SPI flash, split into partitions described by a partition table at offset 0x8000:
| Region | Typical size | Purpose |
|---|---|---|
| Bootloader | ~28 KB at 0x1000 | Starts the chip |
| Partition table | 4 KB at 0x8000 | Map of the rest |
| NVS | 20–24 KB | Preferences, Wi-Fi credentials |
| otadata | 8 KB | Which OTA slot to boot |
| app0 / app1 | 1.2–6.5 MB each | Your firmware (two slots for OTA updates) |
| SPIFFS / LittleFS / FAT | Remaining space | Files, web pages, logs |
| coredump | 64 KB (optional) | Crash dumps |
Arduino IDE partition schemes (4 MB flash)
| Scheme | App size (each) | OTA | Filesystem |
|---|---|---|---|
| Default 4MB with spiffs | 1.25 MB | Yes | 1.4 MB |
| Minimal SPIFFS | 1.9 MB | Yes | 190 KB |
| Huge APP | 3 MB | No | 896 KB |
| No OTA (2MB APP/2MB SPIFFS) | 2 MB | No | 2 MB |
Fixing "Sketch too big"
A sketch using Wi-Fi, Bluetooth and TLS easily passes 1.3 MB, overflowing the default 1.25 MB app slot. Options:
- Tools → Partition Scheme → Minimal SPIFFS if you still need OTA updates.
- Huge APP if you don't need OTA.
- A board with 8 MB or 16 MB flash (ESP32-S3 boards commonly have 8–16 MB) and a matching scheme.
- Disable Bluetooth if unused; it adds several hundred kilobytes.
Checking your chip's flash size
Run esptool.py flash_id or look at the module marking: ESP32-WROOM-32E modules come in 4, 8 and 16 MB variants. The ESP32-C3 SuperMini and most XIAO boards have 4 MB.
Formula, inputs and worked examples
Formula and method
Available app space depends on the selected partition table and reserved bootloader, partition table, NVS, OTA/data partitions; calculate from the actual layout rather than a universal fixed formula.
Worked examples
Default Arduino layout on 4 MB
Two 1.25 MB app slots, 1.4 MB SPIFFS and 20 KB NVS fill about 3.9 MB, leaving essentially nothing spare.
Web server with OTA
A 1.6 MB sketch with a 150 KB web UI fits the Minimal SPIFFS scheme: 1.9 MB per app slot and 190 KB for files.
ESP32-S3 with 16 MB
Two 3 MB app slots for OTA still leave about 9.9 MB for a LittleFS image holding audio files or logs.
Inputs
- Physical flash capacity — Unit: MiB
- Bootloader and partition table reserves — Unit: MiB
- NVS and filesystem sizes — Unit: MiB
- Application slot size and count — Unit: MiB and count
What the result means
- Total allocated/reserved — Unit: MiB
- Remaining or over-budget amount — Unit: MiB
Practical tips and common mistakes
- Partition sizes must be multiples of 4 KB, and app partitions must start on a 64 KB boundary.
- Keep at least 10–20 % of each app slot free so future updates still fit.
- Changing the partition table erases existing filesystem data; back it up first.
Assumptions and limitations
- Read the selected partition CSV or board configuration before relying on a displayed estimate.
- OTA layouts commonly reserve space for multiple app slots; changing the layout can erase data and affect update behavior.
- Leave room for filesystem, NVS, and future firmware growth.
Frequently asked questions
How much flash does an ESP32 have?
Most ESP32 dev boards have 4 MB. ESP32-S3 boards commonly have 8 MB or 16 MB, and some modules up to 32 MB. The chip itself has no internal flash except a few variants (ESP32-PICO, some C3/S3 'FN' parts).
How do I fix 'Sketch too big' on ESP32?
Choose a partition scheme with a bigger app slot in Tools → Partition Scheme: Minimal SPIFFS (1.9 MB with OTA) or Huge APP (3 MB without OTA).
Why does OTA need two app partitions?
The new firmware is written to the inactive slot while the old one keeps running. Only after it is verified does the bootloader switch, so a failed update can't brick the device.
Should I use SPIFFS or LittleFS?
LittleFS. SPIFFS is deprecated, slower, and lacks real directories. Both use the same 'spiffs' partition type in the table.
Learn more
More MCUs