Is It Safe to Delete the DirectX Shader Cache on Windows
The DirectX Shader Cache holds shaders, the small programs a graphics card runs, after Windows has compiled them, so games and apps do not have to compile them again. It is safe to delete, and Windows offers it in its own cleanup tools. The catch is that the next launch has to rebuild it, so games may load slowly or stutter for a while. Clear it when it is taking real space or when you suspect it is damaged, and not as routine maintenance.
Where it lives
The system cache is %LOCALAPPDATA%\D3DSCache, with a folder inside it for each cache. Graphics drivers and games keep their own as well:
| Path under your user folder | Owner |
|---|---|
AppData\Local\D3DSCache |
Windows DirectX |
AppData\Local\Microsoft\DirectX Shader Cache |
Windows DirectX pipeline cache |
AppData\Local\NVIDIA\DXCache, AppData\Local\NVIDIA\GLCache |
NVIDIA |
AppData\LocalLow\NVIDIA\PerDriverVersion\DXCache |
NVIDIA |
AppData\Local\AMD\DXCache, AppData\Local\AMD\VkCache |
AMD |
AppData\Local\Intel\ShaderCache, AppData\LocalLow\Intel\ShaderCache (current drivers) |
Intel |
AppData\Local\VulkanCache |
Vulkan |
Which ones exist depends on your graphics hardware. Steam keeps a cache per game in its own library, see Steam's shader cache. To measure the system one:
$p = "$env:LOCALAPPDATA\D3DSCache"
[math]::Round((Get-ChildItem $p -Recurse -Force -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum / 1MB, 1)
The figure is in MB.
When clearing it helps
| You see | Clear it? | Why |
|---|---|---|
| Glitches, crashes or stutter that began after a driver update | Worth a try | A stale or damaged entry can be the cause, and a rebuild replaces it |
| The cache has grown to many gigabytes and you need the space | Yes | It regenerates, though only for games you play again |
| A game stutters the first time through each area | No | That is the cache being filled, and clearing it makes this happen again |
| General PC slowness | No | It has nothing to do with this |
| Routine cleanup | Not needed | You pay the rebuild for little gain |
How to clear it
The built-in way, for the system cache:
- Open Settings › System › Storage › Temporary files.
- Tick DirectX Shader Cache, leaving the rest as you want it.
- Choose Remove files.
Disk Cleanup (cleanmgr) has the same option. Windows registers it as a cleanup handler, D3D Shader Cache, and the test ThinkPad had it too.
By hand, close your games and graphics tools, open %LOCALAPPDATA%\D3DSCache with Win + R, and delete what is inside. Skip anything that is in use. For a driver's cache, delete the contents of the folder above with the game closed. NVIDIA Control Panel's Shader Cache Size only limits how large it can grow.
What to expect afterwards
The first launch of each game compiles shaders again. Some games show a progress bar, others stutter as you move through new areas until the cache is full. How long depends on the game and your hardware, and it can be minutes. Do not judge the result from the first session.
What not to do
- Do not clear it before a game session or a benchmark. It will be at its slowest.
- Do not schedule it. It is not junk that piles up in any harmful way, and a cache that is always empty means always compiling.
- Do not delete the driver's folders outside the paths above.
C:\Windows\System32\DriverStoreand the driver's install folders are not caches. - Do not expect it to fix a game with broken files. Use the launcher's verify option for that.
Where Mole fits
Mole for Windows' Clean lists these caches by name, including DirectX Shader Cache, DirectX Pipeline Cache and the NVIDIA, AMD and Vulkan folders above, plus Intel's older Local folder, each with its size. Mole does not list the LocalLow folder that current Intel drivers use. They start unticked and Recommended leaves them out, because each game then has to compile its shaders again. Tick one when you have decided that cost is worth it. Steam's per-game caches appear the same way, and the NVIDIA cache in ProgramData needs admin. For the rest of the folder they sit in, see what you can delete in AppData.
FAQ
Is it safe to delete the DirectX Shader Cache?
Yes. Windows rebuilds it. The cost is slower loading or some stutter in games the next time they run.
Will deleting the shader cache improve performance?
Usually not, and in the short term it gets worse. It helps when a damaged cache is causing glitches, or when you need the disk space.
Where is the DirectX Shader Cache stored?
In %LOCALAPPDATA%\D3DSCache. NVIDIA, AMD, Intel and Steam keep caches of their own in other folders.
Why does the shader cache keep coming back?
Because games and apps compile shaders again as they run. That is what it is for, so it is not a sign that the cleanup failed.
Should I clear the shader cache after a driver update?
Only if something is wrong after the update. Drivers commonly rebuild what they need, and clearing it is a fair step when you see glitches or crashes.