LittleFS is now the recommended filesystem for the ESP8266 Arduino core, and SPIFFS, its predecessor, carries a deprecation warning. Many popular boards, from the NodeMCU to the Wemos D1 mini, still run sketches written in the SPIFFS era. This article explains why the core moved on, what changes when you switch, and how to migrate both code and stored data without an unpleasant surprise.
LittleFS facts in this article were checked against the ESP8266 Arduino core documentation and the upstream littlefs repository on 23 November 2026. Menu names in the Arduino IDE and PlatformIO can vary slightly between releases, so treat them as signposts rather than exact labels.
Why the ESP8266 core moved to LittleFS
LittleFS arrived in the ESP8266 Arduino core through a contribution that added a LittleFS object using exactly the same API as the existing SPIFFS filesystem. The goal was a drop-in alternative for onboard flash, with directories, better performance and power-loss resilience. The core's filesystem documentation now states that SPIFFS is deprecated and may be removed in future releases, and asks developers to move their code to LittleFS.
LittleFS addresses the two biggest complaints about SPIFFS. SPIFFS has a flat namespace, so “directories” were only a naming convention, and it slows down considerably as it fills. LittleFS offers real directories and copy-on-write updates that keep the filesystem consistent if power is cut mid-write.
LittleFS is not free of trade-offs, and it is worth knowing them before you migrate. Community write-ups of the core documentation point out that LittleFS has a higher per-file overhead, with a 4 KB minimum allocation unit compared with 256 bytes for SPIFFS. Projects that store hundreds of tiny files may therefore fit less data, while projects with a handful of larger files rarely notice.
What changes in your code
LittleFS on the ESP8266 is deliberately source-compatible with SPIFFS. In most sketches the migration is a find-and-replace of the object name and a change of include.
// Before
#include <FS.h>
SPIFFS.begin();
File f = SPIFFS.open("/config.json", "r");
// After
#include <LittleFS.h>
LittleFS.begin();
File f = LittleFS.open("/config.json", "r");
LittleFS also brings genuine directory functions, such as LittleFS.mkdir() and LittleFS.rmdir(), and File objects gain isDirectory() and openNextFile() for walking a tree. Code that relied on SPIFFS treating slashes as ordinary characters may need adjusting, because in LittleFS a path like /logs/today.txt really does require a logs directory.
Libraries that still mention SPIFFS
LittleFS-based sketches sometimes still trigger SPIFFS deprecation warnings at compile time. Forum threads show this happening when a third-party library, such as an older web-server editor, references the SPIFFS object internally. If your own code uses LittleFS, the warning comes from the library, and the fix is to update the library or pass it a LittleFS object where it allows one.
The critical warning: formats are not interchangeable
LittleFS and SPIFFS store data in completely different on-flash formats. The ESP8266 core documentation is explicit that both begin() methods format the filesystem automatically if they cannot detect one, so calling SPIFFS.begin() on a LittleFS partition, or the reverse, erases everything on it.
LittleFS migrations on devices in the field therefore need a plan. If a deployed unit holds data you care about, such as calibration values, you have three options:
- Rebuild the data: if everything stored is generated or downloadable, simply let LittleFS format and repopulate.
- Migrate in firmware: ship a transitional build that mounts SPIFFS, reads the important values into RAM, ends SPIFFS, mounts LittleFS (formatting it) and writes the values back.
- Keep data elsewhere temporarily: copy values to EEPROM emulation or a server before switching.
LittleFS should not be mounted until the SPIFFS step has finished, because both occupy the same flash region in the default layout.
Flash layout and filesystem size
LittleFS on the ESP8266 lives in a region of flash set aside by the board's flash layout. In the Arduino IDE, the Flash Size menu offers combinations such as “4MB (FS:2MB OTA:~1019KB)”, which divide the chip between the sketch, space for over-the-air updates, the filesystem and small areas for EEPROM emulation and Wi-Fi settings.
LittleFS capacity is therefore a trade-off with OTA space. If you need a large filesystem and do not use OTA updates, choose a layout with a bigger FS portion. Changing the layout moves the filesystem, so expect to re-upload or reformat it afterwards.
Uploading files to LittleFS
LittleFS images are built from a data folder inside your sketch directory. For the classic Arduino IDE 1.x, the core documentation points to the arduino-esp8266littlefs-plugin, which adds a Tools → ESP8266 LittleFS Data Upload command. For Arduino IDE 2, the newer arduino-littlefs-upload plug-in serves the same purpose. PlatformIO users add board_build.filesystem = littlefs to platformio.ini and run the Upload Filesystem Image task.
LittleFS upload failures usually come from a mismatch between the image size and the chosen flash layout. Select the same Flash Size option for both the sketch and the data upload.
Reading filesystem information
LittleFS exposes usage statistics through LittleFS.info(), which fills an FSInfo structure with totals such as total and used bytes, block size and maximum path length. Logging these values at boot is an easy way to notice a filesystem filling up before writes start failing.
FSInfo info;
LittleFS.info(info);
Serial.printf("Used %u of %u bytes (block %u)\n",
info.usedBytes, info.totalBytes, info.blockSize);
LittleFS reports space in whole blocks, so the used figure jumps in 4 KB steps rather than by the exact size of your files. A freshly formatted filesystem already shows a couple of blocks in use for its metadata.
Good habits on the ESP8266
LittleFS rewards a few simple habits on this memory-constrained chip.
- Close files quickly. Each open file holds a cache buffer in RAM, and data is only committed on close or flush.
- Prefer fewer, larger files. Because of the 4 KB minimum allocation, appending records to one log file is more efficient than creating a new file per reading.
- Avoid writing on every loop. Flash endures a finite number of erases; buffer values and write at sensible intervals.
- Check return values.
open()returns a falsyFileon failure, and writing to it silently does nothing.
Troubleshooting checklist
LittleFS issues on the ESP8266 tend to follow familiar patterns.
| Symptom | Likely cause | Fix |
|---|---|---|
| All files vanished after an update | Code switched between SPIFFS and LittleFS | Migrate data before switching; see above |
begin() returns false |
No filesystem area in the chosen layout | Pick a Flash Size option with an FS portion |
| Upload tool does nothing | Wrong plug-in for the IDE version | Use the plug-in matching your Arduino IDE |
| Out of space sooner than expected | Many small files at 4 KB each | Combine data into fewer files |
| Directory open fails | Parent directory missing | Create it with LittleFS.mkdir() first |
Testing the migration before release
LittleFS migrations deserve a rehearsal on spare hardware. Flash a board with your current SPIFFS firmware, populate it with realistic data, then install the transitional build and confirm that every important value reappears under LittleFS. Pull the power at different moments during the migration to make sure an interrupted run does not leave the device unable to boot. Only when that test passes repeatedly should the update go to devices in the field.
Memory considerations on the ESP8266
LittleFS buffers live in the ESP8266's limited RAM, and every open file holds its own cache. Sketches that keep several files open while also running a web server and TLS can run short of heap. Open files only while you need them, avoid holding large String objects read from files, and check free heap during development to catch problems before deployment.
Checking a migration before release
A safe migration begins with an inventory of the files currently stored on the device. Separate data that can be recreated from data that belongs to the user, such as network settings or recorded measurements. Copy the important files to a computer or another trusted destination before changing the filesystem layout. A new image or a format operation can replace existing contents.
Next, verify the board selection and flash layout used by the build. The filesystem size must match the space reserved by the selected configuration. If the device has less usable space than expected, reduce the amount of bundled content or choose a suitable layout before attempting an upload. Check that the upload tool and the sketch refer to the same board and storage region.
Update the application one operation at a time. Mount the new filesystem, open a known file and verify its contents before adding logging or web serving. Check return values when opening and writing files, and close each handle when finished. Paths and file names should be tested with the actual files shipped in the data folder, including capitalisation.
After the basic test works, restart the board and repeat the read. Then test a missing configuration file, low free space and an interrupted update. If a setting cannot be read, show a useful diagnostic and use a controlled recovery path instead of silently erasing the filesystem. Keep the old backup until the upgraded device has operated successfully with real data for long enough to confirm the migration.
Frequently Asked Questions
Is SPIFFS still available on the ESP8266?
LittleFS is the recommended choice, and the core documentation marks SPIFFS as deprecated and subject to future removal. Community reports suggest some newer core builds have taken further steps in that direction, so new projects should not depend on SPIFFS.
Will my SPIFFS files appear after switching to LittleFS?
LittleFS cannot read SPIFFS data. Mounting LittleFS on a SPIFFS partition reformats it, so copy anything important first.
Why does LittleFS show space used on an empty filesystem?
LittleFS reserves blocks for its superblock and metadata, so a freshly formatted filesystem already reports a small amount in use.
Can I use LittleFS and an SD card together?
LittleFS, SD and SDFS are designed to be source-compatible in the ESP8266 core, so a sketch can use the onboard filesystem and an SD card side by side.
Does LittleFS protect against power loss on the ESP8266?
LittleFS keeps the filesystem consistent after a power cut, falling back to the last committed state. Data you had not yet closed or flushed may be lost, but the filesystem will not be corrupted.
How much RAM does LittleFS use on the ESP8266?
LittleFS needs read, program and lookahead buffers plus one cache per open file, so usage grows with the number of files you keep open at once.
Conclusion
LittleFS is the future of file storage on the ESP8266, and for most sketches the migration is just a change of object name. The one serious trap is the incompatible on-flash format, so plan how existing data will be carried across before shipping the switch. Pick a flash layout with enough filesystem space, upload your data folder with the right plug-in and keep files few and well closed. For the newer Espressif chips, continue with our LittleFS ESP32 article, and for patterns shared across Arduino cores see LittleFS Arduino.