Free FiveM cache cleaner for Windows: clears every server's cache in one click, keeps your key bindings (download + full source)
A Windows .bat file players double-click to clear the FiveM cache for every server (cache, server-cache, nui-storage) without losing key bindings, graphics settings or the Rockstar link. Backs up fivem.cfg first. Fixes stuck loading, map not loading and stale files after a server update. Full source included.
"Clear your cache first" is the first thing every admin tells a player who is stuck on the loading screen, falls through the map, or still sees old files after a server update. Half the players cannot find the folder; the other half delete the wrong one and lose every key binding. This file fixes both: double-click, press Y, done.
Download
x3d-fivem-clear-cache.zip (2 KB, contains the .bat and a README), or read the full source below and create it yourself in Notepad.
- Extract the zip anywhere (the Desktop is fine)
- Double-click
x3d-fivem-clear-cache.bat, read the list of what will be deleted, typeY - Start FiveM normally. The first join to each server re-downloads its files, so it is slower once
Server admins can send players this link instead of explaining folders again.
What it deletes and what it never touches
| Deleted | Kept |
|---|---|
FiveM.app\data\cache\* except the priv folder |
every key binding (%APPDATA%\CitizenFX\fivem.cfg) |
FiveM.app\data\server-cache\*, files downloaded from every server (the big one, often several GB) |
graphics and audio settings (%APPDATA%\CitizenFX) |
FiveM.app\data\server-cache-priv\*, per-server data |
your linked Rockstar/Steam account (data\cache\priv) |
FiveM.app\data\nui-storage\*, per-server UI storage |
data\game-storage, GTA V game files, mods in plugins/ |
Before deleting anything the script backs up fivem.cfg next to the .bat as fivem.cfg.backup-<date-time>.txt. If anything goes wrong, copy it back to %APPDATA%\CitizenFX\fivem.cfg.
The script closes FiveM first (files in use cannot be deleted), looks for FiveM in the default location %LOCALAPPDATA%\FiveM\FiveM.app, then in the registry entry FiveM writes on every launch. If it still cannot find it, drag your FiveM folder onto the .bat.
Full source (read it before you run it)
The script ships as a plain text file with nothing hidden. Paste all of this into Notepad and Save As x3d-fivem-clear-cache.bat (Save as type: All Files) for the exact same result as the zip.
@echo off
setlocal EnableExtensions EnableDelayedExpansion
title X3D FiveM Cache Cleaner 1.0
:: X3D FiveM Cache Cleaner 1.0
:: https://fivem.x3d-developer.com/th/blog/fivem-clear-cache-script/
:: Clears the FiveM cache for EVERY server in one go.
:: Keeps: key bindings, settings, Rockstar/Steam link.
:: Usage: double-click. Or drag your FiveM folder onto this file if FiveM is installed somewhere else.
echo.
echo ==============================================
echo X3D FiveM Cache Cleaner 1.0
echo fivem.x3d-developer.com
echo ==============================================
echo.
set "APP="
if not "%~1"=="" (
if exist "%~1\data\cache" set "APP=%~1"
if exist "%~1\FiveM.app\data\cache" set "APP=%~1\FiveM.app"
)
if not defined APP if exist "%LOCALAPPDATA%\FiveM\FiveM.app\data\cache" set "APP=%LOCALAPPDATA%\FiveM\FiveM.app"
if not defined APP (
for /f "tokens=3,*" %%A in ('reg query "HKCU\Software\CitizenFX\FiveM" /v "Last Run" 2^>nul ^| find /i "Last Run"') do set "LASTRUN=%%B"
if defined LASTRUN for %%F in ("!LASTRUN!") do if exist "%%~dpFFiveM.app\data\cache" set "APP=%%~dpFFiveM.app"
)
if not defined APP (
echo Could not find the FiveM folder ^(FiveM.app^).
echo Drag your FiveM folder onto this file and try again.
echo.
pause
exit /b 1
)
echo FiveM folder : %APP%
echo.
echo This deletes cached files for EVERY server:
echo data\cache\* ^(except "priv" = Rockstar link^)
echo data\server-cache\* ^(downloaded server files^)
echo data\server-cache-priv\* ^(per-server data^)
echo data\nui-storage\* ^(per-server UI storage^)
echo.
echo It KEEPS key bindings, game settings and your Rockstar/Steam link.
echo ^(%%APPDATA%%\CitizenFX and data\game-storage are never touched.^)
echo A backup copy of fivem.cfg ^(key bindings^) is saved next to this file first.
echo.
set "ANS="
set /p "ANS= Continue? [Y/N] "
if /i not "%ANS%"=="Y" (
echo Cancelled.
pause
exit /b 0
)
echo.
echo Closing FiveM...
taskkill /F /T /IM "FiveM*" >nul 2>&1
timeout /t 2 /nobreak >nul
set "STAMP=%DATE%_%TIME%"
set "STAMP=%STAMP:/=-%"
set "STAMP=%STAMP::=-%"
set "STAMP=%STAMP: =0%"
set "STAMP=%STAMP:,=.%"
set "BK=%~dp0"
if exist "%APPDATA%\CitizenFX\fivem.cfg" (
copy /y "%APPDATA%\CitizenFX\fivem.cfg" "%BK%fivem.cfg.backup-%STAMP%.txt" >nul 2>&1 || (
set "BK=%TEMP%\"
copy /y "%APPDATA%\CitizenFX\fivem.cfg" "!BK!fivem.cfg.backup-%STAMP%.txt" >nul 2>&1
)
echo Backup of key bindings: !BK!fivem.cfg.backup-%STAMP%.txt
)
set /a N=0
if exist "%APP%\data\cache" (
for /d %%D in ("%APP%\data\cache\*") do (
if /i not "%%~nxD"=="priv" (
rd /s /q "%%D" >nul 2>&1
if not exist "%%D" set /a N+=1
)
)
del /f /q "%APP%\data\cache\*.*" >nul 2>&1
)
for %%D in ("server-cache" "server-cache-priv" "nui-storage") do (
if exist "%APP%\data\%%~D" (
rd /s /q "%APP%\data\%%~D" >nul 2>&1
if not exist "%APP%\data\%%~D" set /a N+=1
)
)
echo.
echo Done. Removed %N% cache folder^(s^).
echo Start FiveM normally. The first join to each server re-downloads its files, so it takes a bit longer once.
echo.
pause
exit /b 0
Doing it by hand
If you would rather not run a script, this is the same thing manually.
- Close FiveM completely (check Task Manager for
FiveM.exeandFiveM_GTAProcess.exe) - Press
Win + R, type%localappdata%\FiveM\FiveM.app\data, Enter - Inside
cache, delete everything except theprivfolder - Delete the
server-cache,server-cache-privandnui-storagefolders entirely - Leave
game-storagealone and never touch anything in%appdata%\CitizenFX
When to clear the cache
- Stuck on the loading screen for one server while others work (every cause of a stuck loading screen)
- Falling through the map, missing map, map loading too late after the server changed MLOs or cars (FiveM map not loading)
- The server updated a script but your UI still shows the old version, or in-game images are wrong
- FiveM updated to a new build and a server you joined yesterday no longer loads
- Crashing with
Recursive error: Streamer crashedorproductId != ProductID::INVALID(clear the cache after the shader cache change in the Streamer crashed fix)
Not every day. Only when something is wrong, because every clear re-downloads every server's files.
FAQ
Do I lose my key bindings? No. Bindings set in Settings › Key Bindings live in %APPDATA%\CitizenFX\fivem.cfg, which the script never touches, and it backs that file up next to the .bat every time.
Do I have to sign in to Rockstar/Steam again? No. The script skips the priv folder that stores the account link.
Windows or my antivirus warns when I open the .bat — normal for any unsigned .bat file. Every line of the source is above. If SmartScreen appears, click More info › Run anyway, or create the file yourself from the source in Notepad.
FiveM is installed on another drive — drag the folder that contains FiveM.exe (or the FiveM.app folder) onto the .bat and the script uses that location.
Still stuck after clearing — if other players on the server hang too, the problem is server side; send your admin the server-owner section of the stuck-loading guide. If it is only you, continue down that guide's player list (disable ReShade, verify game files, move to an SSD).
macOS/Linux? FiveM runs on Windows only, so this is a .bat for Windows 10/11.
Server owners who want fewer stuck-loading tickets at the source: X3D Loading Screen (free) shows the resource actually loading and closes the screen when the world is ready. All free scripts are in the free FiveM scripts post.