# Is it safe to delete ~/.cache/huggingface?

Is it safe to delete? · AI tools · Updated 21 November 2026. By Mohit Nippanikar, who makes SiftMac.

## The short answer

- **Yes, but pick what goes.** It’s where Hugging Face’s Python libraries keep every model and dataset file you’ve downloaded, and they don’t delete any of it themselves. Use `hf cache rm` and `hf cache prune` rather than deleting folders by hand.
- **What it costs you:** a fresh download the next time your code loads a model or dataset you removed. Your Hugging Face login token sits in the same folder, so don’t delete the folder whole.
- **Does it come back?** Yes: when code asks for a model or dataset that isn’t cached, it downloads it again.
- SiftMac’s verdict: You decide

## 1. What it is

`transformers`, `diffusers`, `datasets` and other libraries built on `huggingface_hub` download files from the Hugging Face Hub into one shared cache, so a model fetched by one script is reused by the next. Hugging Face’s documentation is plain about the catch: cached files are never deleted, and when you download a newer revision of a model, the previous files are kept in case you need them again.

- `hub/`: models, datasets and Spaces from the Hub, one folder each, named like `models--org--name`.
- `datasets/`: Arrow files the `datasets` library prepared from those downloads.
- `xet/`: data the Xet storage system keeps to speed up uploads.
- `token`: your User Access Token, if you’ve signed in.

## 2. Where it is

```
~/.cache/huggingface
```

That’s the default. `HF_HOME` moves the whole thing, `HF_HUB_CACHE` moves only `hub`, and `HF_DATASETS_CACHE` only the `datasets` cache. Inside each repository’s folder, `blobs` holds the actual files, `snapshots` has one folder of links per revision, and `refs` records which revision a branch such as `main` points to.

## 3. How big it gets

Model weights make up nearly all of it, and every revision you’ve downloaded counts. Hugging Face’s CLI lists each repository with its size and when you last used it, and can show revisions you haven’t touched in a while:

```
hf cache ls
hf cache ls --revisions --filter "accessed>30d"
du -sh ~/.cache/huggingface/*
```

Older installs without the `hf` command have `huggingface-cli scan-cache` for the same report.

## 4. How to delete it safely

Remove whole models or datasets you no longer use. `hf cache rm` asks before deleting, and `--dry-run` shows what would go:

```
hf cache rm model/<org>/<name> --dry-run
hf cache rm model/<org>/<name>
```

Then clear the leftovers. `hf cache prune` deletes revisions that no branch or tag points to any more, partial files from interrupted downloads, and shared files no cached repository uses:

```
hf cache prune
```

With older versions, `huggingface-cli delete-cache` opens a list where you tick what to remove.

The CLI is safer than Finder here. Recent versions store some files once, in a shared `blobs` folder at the top of `hub`, for every repository that uses them, and only `hf cache rm` and `hf cache prune` know when those can go. The `xet` folder is the exception: Hugging Face’s docs say you can remove it entirely to reclaim its space.

## 5. What happens afterwards

- The next `from_pretrained()` or `load_dataset()` that needs a removed repository downloads it again. That needs the internet and, for gated models, your token.
- Code running offline, with `HF_HUB_OFFLINE=1` set, only reads the cache, so it raises an error for anything you removed.
- Repositories you kept, and their revisions, are untouched, and your token stays where it was.

## Questions

### Can I delete the whole ~/.cache/huggingface folder?

You can, with no Python process using it, but you also delete your login token. Removing `hub` and `datasets` and keeping the rest gives back almost the same space without signing in again.

### Why is the cache bigger than the models I use?

Every revision you’ve downloaded stays, and so do models from old experiments. `hf cache ls --revisions` shows them, and `hf cache prune` removes revisions nothing points to.

### Does deleting the cache remove models I fine-tuned?

Not if you saved them to your own folder with `save_pretrained()`. Only files downloaded from the Hub live in the cache.

### Is this the cache LM Studio and Ollama use?

No. [LM Studio](https://siftmac.com/safe-to-delete/lm-studio-models) and [Ollama](https://siftmac.com/safe-to-delete/ollama-models) keep their own copies of models, outside `~/.cache/huggingface`.

## How SiftMac handles it

Its AI files category lists each model folder in `~/.cache/huggingface/hub` (`models--org--name`) with its size and when it last changed. Models are You decide and never ticked for you, and one you choose is removed straight away rather than kept on the Undo Shelf; datasets and the rest of the cache are left alone.

Download: https://siftmac.com/SiftMac.dmg (scanning is free, and so is the first 2 GB of cleaning).

## Sources

- [Hugging Face: Understand caching (manage the huggingface_hub cache)](https://huggingface.co/docs/huggingface_hub/guides/manage-cache)
- [Hugging Face Datasets: Cache management](https://huggingface.co/docs/datasets/cache)
- [Hugging Face: Environment variables (HF_TOKEN_PATH, HF_HUB_OFFLINE)](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables)

## Related

- [Is it safe to delete Ollama models in ~/.ollama/models?](https://siftmac.com/safe-to-delete/ollama-models)
- [Is it safe to delete LM Studio’s models folder?](https://siftmac.com/safe-to-delete/lm-studio-models)
- [Is it safe to delete ~/Library/Caches/pip?](https://siftmac.com/safe-to-delete/pip-cache)
- [What fills a data scientist’s Mac: environments, caches and datasets](https://siftmac.com/for/data-scientists)
- [What Claude Code, Cursor, Ollama and Hugging Face leave on your Mac](https://siftmac.com/guides/ai-files-on-mac)

Canonical: https://siftmac.com/safe-to-delete/hugging-face-cache
