espsss / reference / quick / filesystems

SPIFFS vs LittleFS vs FFat

The three flash filesystems that arduino-esp32 ships, side by side: limits, defaults of begin(), and the partition each one mounts.

In short

  • SPIFFS has no directories: the whole path is the file name, limited to 31 characters.1
  • LittleFS has directories, names of up to 255 bytes per path component on a partition formatted on the device, and power-loss resilience; in Arduino it mounts the partition labelled "spiffs", so the default partition schemes work unchanged.2
  • FFat needs a partition with subtype fat labelled "ffat" (e.g. "Default 4MB with ffat") and runs on ESP-IDF's wear-levelling layer; Arduino builds enable 255-character long file names.3
  • begin() defaults for all three: formatOnFail = false, maxOpenFiles = 10 (LittleFS ignores it).4

Side by side

SPIFFSLittleFSFFat
Arduino begin() defaultsbegin(formatOnFail=false, "/spiffs", maxOpenFiles=10, label=NULL)4begin(formatOnFail=false, "/littlefs", maxOpenFiles=10, label="spiffs")5begin(formatOnFail=false, "/ffat", maxOpenFiles=10, label="ffat")6
Partition it mountsfirst data partition with subtype spiffs1the partition labelled "spiffs", any subtype7data partition with subtype fat and label "ffat"3
Max name length31 characters (32 with the terminating zero) for the whole path, leading "/" included81255 bytes per path component (littlefs default LFS_NAME_MAX); an image built on a PC keeps the name_max it was made with29255 characters per path component (long file names on, buffer on stack)1011
Directoriesno: flat; "/a/b.txt" is one file name1yes12yes13
Wear levellingyes, built in1dynamic wear levelling, built in12ESP-IDF wear_levelling layer under FAT314
Power losscan corrupt the FS; esp_spiffs_check() may recover it1falls back to the last known good state12
maxOpenFilesused (max_files)15ignored: esp_littlefs has no open-file limit1617used (max_files)3
Usable spaceabout 75% of the partition1partition minus 4 wear-levelling sectors and the FAT structures13

SPIFFS limits the whole path inside the filesystem, LittleFS and FAT limit each path component. Values as the arduino-esp32 3.3.12 libraries are built (ESP-IDF and esp_littlefs defaults; FAT long names enabled by the Arduino lib-builder config).

LittleFS name length, checked on a board

A sketch formatted the "spiffs" partition with LittleFS.format(), mounted it and created one file per name length.

Name length (without the leading "/")Result
63, 64, 100, 250 characterscreated, written, found
255 characterscreated, written, found
256 charactersopen fails
200-character directory name with a file insidecreated

Which partition scheme

Arduino IDE: Tools → Partition Scheme. The full list with sizes is on the partitions page.

Scheme (ESP32S3 Dev Module)Data partitionWorks with
Default 4MB with spiffsspiffs, data, spiffs, 0x290000, 0x160000SPIFFS, LittleFS18
Default 4MB with ffatffat, data, fat, 0x290000, 0x160000FFat18

begin() and formatOnFail

SPIFFS and LittleFS

With formatOnFail = true the library formats the partition only when mounting fails with ESP_FAIL, then mounts again. Formatting erases all files.15

FFat

formatOnFail is passed to ESP-IDF as format_if_mount_failed. FFat.format() erases the first 16 KB by default (quick wipe, the FAT area) or the whole partition with FFAT_WIPE_FULL, then mounts with format_if_mount_failed = true, which creates a new empty FAT.3

Another partition

Pass the label as the fourth argument, e.g. LittleFS.begin(false, "/data", 10, "storage"). SPIFFS with label NULL takes the first spiffs partition.5

Pitfalls

Long names on FAT outside Arduino

In plain ESP-IDF long file names are off by default (8.3 names only); Arduino's prebuilt libraries switch them on. An ESP-IDF project needs CONFIG_FATFS_LFN_HEAP or _STACK.11

Long paths on SPIFFS

Because the path is the name, the leading "/" counts: "/config/network/wifi.json" (25 characters) fits, but deeper paths quickly reach the 31-character limit.8

LittleFS image tools and name length

A LittleFS image built on the PC stores its name_max in the superblock, and on mount the firmware uses that value instead of 255, so names on that image are limited by the tool that built it (an image with a name_max above 255 is refused). esp_littlefs's own image target passes CONFIG_LITTLEFS_OBJ_NAME_LEN; esp_littlefs warns that prebuilt mklittlefs releases were most likely built with LFS_NAME_MAX=32.19

Same partition, two filesystems

SPIFFS and LittleFS both use the "spiffs" partition of the default scheme. Switching from one to the other does not carry the files over: the partition has to be formatted for the new filesystem (formatOnFail = true formats it when mounting fails).5

Sources

Each number links here; open “What it confirms” for the exact quotes. Checked 2026-11-28.

  1. ESP-IDF v5.5.5 docs (esp32s3): SPIFFS Filesystem primary
    What it confirms (7)
    • SPIFFS vs LittleFS vs FFat: in short “Currently, SPIFFS does not support directories, it produces a flat structure. … default 32 … Note that this length include the zero-termination character”
    • SPIFFS vs LittleFS vs FFat: Partition it mounts / SPIFFS “If set to NULL, first partition with subtype=spiffs will be used.”
    • SPIFFS vs LittleFS vs FFat: Max name length / SPIFFS “creating a file with the path /spiffs/tmp/myfile.txt will create a file called /tmp/myfile.txt in SPIFFS”
    • SPIFFS vs LittleFS vs FFat: Directories / SPIFFS “Currently, SPIFFS does not support directories, it produces a flat structure.”
    • SPIFFS vs LittleFS vs FFat: Wear levelling / SPIFFS “It supports wear levelling, file system consistency checks, and more.”
    • SPIFFS vs LittleFS vs FFat: Power loss / SPIFFS “When the chip experiences a power loss during a file system operation it could result in SPIFFS corruption. However the file system still might be recovered via esp_spiffs_check function.”
    • SPIFFS vs LittleFS vs FFat: Usable space / SPIFFS “SPIFFS is able to reliably utilize only around 75% of assigned partition space.”
  2. littlefs (commit 6cb4e86, the submodule of esp_littlefs v1.22.3): lfs.h primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: in short “#define LFS_NAME_MAX 255 … **Power-loss resilience** - littlefs is designed to handle random power failures. … const char *partitionLabel = "spiffs");”
    • SPIFFS vs LittleFS vs FFat: Max name length / LittleFS “#define LFS_NAME_MAX 255 … the LFS_NAME_MAX define. Defaults to LFS_NAME_MAX or name_max stored on … if (!lfs->name_max) { … lfs->name_max = LFS_NAME_MAX; … if (nlen > lfs->name_max) { … return LFS_ERR_NAMETOOLONG; … lfs->name_max = superblock.name_max;”
  3. arduino-esp32 3.3.12: libraries/FFat/src/FFat.cpp primary
    What it confirms (5)
    • SPIFFS vs LittleFS vs FFat: in short “ESP_PARTITION_SUBTYPE_DATA_FAT, label); … esp32s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) … CONFIG_FATFS_LFN_STACK=y”
    • SPIFFS vs LittleFS vs FFat: Partition it mounts / FFat “esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, label);”
    • SPIFFS vs LittleFS vs FFat: Wear levelling / FFat “esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(basePath, partitionLabel, &conf, &_wl_handle);”
    • SPIFFS vs LittleFS vs FFat: maxOpenFiles / FFat “.max_files = maxOpenFiles,”
    • SPIFFS vs LittleFS vs FFat: FFat “.format_if_mount_failed = formatOnFail, … uint32_t wipe_size = full_wipe ? wl_size(temp_handle) : 16384; … // Wipe disk- quick just wipes the FAT. Full zeroes the whole disk … // Now do a mount with format_if_fail (which it will) … .format_if_mount_failed = true, … bool format(bool full_wipe = FFAT_WIPE_QUICK”
  4. arduino-esp32 3.3.12: libraries/SPIFFS/src/SPIFFS.h primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: in short “bool begin(bool formatOnFail = false, const char *basePath = "/spiffs", uint8_t maxOpenFiles = 10 … (void)maxOpenFiles;”
    • SPIFFS vs LittleFS vs FFat: Arduino begin() defaults / SPIFFS “bool begin(bool formatOnFail = false, const char *basePath = "/spiffs", uint8_t maxOpenFiles = 10, const char *partitionLabel = NULL);”
  5. arduino-esp32 3.3.12: libraries/LittleFS/src/LittleFS.h primary
    What it confirms (3)
    • SPIFFS vs LittleFS vs FFat: Arduino begin() defaults / LittleFS “bool begin(bool formatOnFail = false, const char *basePath = "/littlefs", uint8_t maxOpenFiles = 10, const char *partitionLabel = "spiffs");”
    • SPIFFS vs LittleFS vs FFat: Another partition “const char *partitionLabel = "spiffs"); … Optional, label of SPIFFS partition to use.”
    • SPIFFS vs LittleFS vs FFat: pitfall: Same partition, two filesystems “const char *partitionLabel = "spiffs"); … first partition with subtype=spiffs will be used. … if (err == ESP_FAIL && formatOnFail) {”
  6. arduino-esp32 3.3.12: libraries/FFat/src/FFat.h primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: Arduino begin() defaults / FFat “#define FFAT_PARTITION_LABEL "ffat" … bool begin(bool formatOnFail = false, const char *basePath = "/ffat", uint8_t maxOpenFiles = 10, const char *partitionLabel = (char *)FFAT_PARTITION_LABEL);”
  7. esp_littlefs v1.22.3: src/esp_littlefs.c primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: Partition it mounts / LittleFS “ESP_PARTITION_SUBTYPE_ANY, … conf->partition_label);”
  8. ESP-IDF v5.5.5: components/spiffs/Kconfig primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: Max name length / SPIFFS “config SPIFFS_OBJ_NAME_LEN … default 32 … Note that this length include the zero-termination character”
    • SPIFFS vs LittleFS vs FFat: pitfall: Long paths on SPIFFS “maximum string of characters can at most be SPIFFS_OBJ_NAME_LEN - 1. … create a file called /tmp/myfile.txt in SPIFFS”
  9. esp_littlefs v1.22.3: project_include.cmake (image generation) primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: Max name length / LittleFS “--name-max=${CONFIG_LITTLEFS_OBJ_NAME_LEN}”
  10. esp32-arduino-lib-builder 6671d0b (the commit listed in versions.txt of the arduino-esp32 3.3.12 libs): configs/defconfig.common primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: Max name length / FFat “CONFIG_FATFS_LFN_STACK=y”
  11. ESP-IDF v5.5.5: components/fatfs/Kconfig primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: Max name length / FFat “config FATFS_MAX_LFN … default 255”
    • SPIFFS vs LittleFS vs FFat: pitfall: Long names on FAT outside Arduino “default FATFS_LFN_NONE … CONFIG_FATFS_LFN_STACK=y”
  12. littlefs (commit 6cb4e86, the submodule of esp_littlefs v1.22.3): README.md primary
    What it confirms (3)
    • SPIFFS vs LittleFS vs FFat: Directories / LittleFS “the littlefs provides a full set of POSIX-like file and directory functions”
    • SPIFFS vs LittleFS vs FFat: Wear levelling / LittleFS “**Dynamic wear leveling** - littlefs is designed with flash in mind, and provides wear leveling over dynamic blocks.”
    • SPIFFS vs LittleFS vs FFat: Power loss / LittleFS “if power is lost the filesystem will fall back to the last known good state.”
  13. ESP-IDF v5.5.5 docs (esp32s3): FAT Filesystem Support primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: Directories / FFat “creating, moving, and deleting files and directories”
    • SPIFFS vs LittleFS vs FFat: Usable space / FFat “For a partition with wear leveling enabled, 4 sectors will be reserved for wear-leveling operations”
  14. ESP-IDF v5.5.5 docs (esp32s3): Wear Levelling API primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: Wear levelling / FFat “The component also has higher-level API functions which work with the FAT filesystem defined in FAT filesystem.”
  15. arduino-esp32 3.3.12: libraries/SPIFFS/src/SPIFFS.cpp primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: maxOpenFiles / SPIFFS “.max_files = maxOpenFiles,”
    • SPIFFS vs LittleFS vs FFat: SPIFFS and LittleFS “if (err == ESP_FAIL && formatOnFail) { … if (format()) {”
  16. arduino-esp32 3.3.12: libraries/LittleFS/src/LittleFS.cpp primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: maxOpenFiles / LittleFS “(void)maxOpenFiles;”
  17. esp_littlefs v1.22.3: README.md primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: maxOpenFiles / LittleFS “field doesn't exist since we removed the file limit”
  18. arduino-esp32 3.3.12: boards.txt primary
    What it confirms (2)
    • SPIFFS vs LittleFS vs FFat: Default 4MB with spiffs “esp32s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) … spiffs, data, spiffs, 0x290000,0x160000,”
    • SPIFFS vs LittleFS vs FFat: Default 4MB with ffat “esp32s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) … ffat, data, fat, 0x290000,0x160000,”
  19. littlefs (commit 6cb4e86, the submodule of esp_littlefs v1.22.3): lfs.c primary
    What it confirms (1)
    • SPIFFS vs LittleFS vs FFat: pitfall: LittleFS image tools and name length “if (superblock.name_max > lfs->name_max) { … lfs->name_max = superblock.name_max; … --name-max=${CONFIG_LITTLEFS_OBJ_NAME_LEN} … If downloading a pre-built release of mklittlefs, it was most-likely … built with LFS_NAME_MAX=32 and should not be used.”