ESP32 Partition calculations

ESP32 Partition size calculations

ESP32 modules come in various flash memory sizes, the most common being 4MB, but 8MB & 16MB modules are available. The flash memory needs to be partitioned depending on requirements & constraints. 

The requirements include:

Constraints include (source):


Some 'standard' partition schemes for the 4MB module are:

“Single factory app, no OTA”

# ESP-IDF Partition Table

# Name,   Type, SubType, Offset,  Size, Flags

nvs,      data, nvs,     0x9000,  0x6000,

phy_init, data, phy,     0xf000,  0x1000,

factory,  app,  factory, 0x10000, 1M,

 “Factory app, two OTA definitions” configuration

# ESP-IDF Partition Table

# Name,   Type, SubType, Offset,  Size, Flags

nvs,      data, nvs,     0x9000,  0x4000,

otadata,  data, ota,     0xd000,  0x2000,

phy_init, data, phy,     0xf000,  0x1000,

factory,  app,  factory, 0x10000,  1M,

ota_0,    app,  ota_0,   0x110000, 1M,

ota_1,    app,  ota_1,   0x210000, 1M,


Tables can be further complicated with multiple OTA partitions:

Creating your own table to support a different layout or different sized module can be require some tedious calculations but to save you can use the following table. Just input the module size & required SPIFFS size & the table will be generated for you!