# Safetensors

> A safe file format for model weights. It holds numbers, never code.

**Field:** Artificial Intelligence  
**Category:** Running Locally  
**Also known as:** .safetensors, Safetensors Format, Safetensors File

## Think of it like

It is like a sealed box of numbers. You can open it, and nothing jumps out.

## Definition

Safetensors is a file format for the weights of a model. It holds only numbers, plus a short list of where each part is. Some older formats could hide code that ran the moment you loaded the file. A safetensors file cannot run code, so it is safe to load from a stranger. It also loads fast, because the numbers are read straight from disk. Most open models on model hubs now come in this format.

## Example

Lucy finds two copies of one model online. One is a .safetensors file and one is an old .bin file. She picks the safetensors one, so loading it cannot run hidden code.

## Why it matters

Loading a model file should never be able to take over your machine. This format makes sure of that.

## Common mistake

Thinking every local app can open it. Many want a GGUF file. So the model may need to be turned into one first.

## Three principles

- **Numbers only.** No code can hide inside.
- **Fast to load.** Read straight from the disk.
- **Hub default.** Most open models ship in it.

## Related terms

- [Model Weights File](https://learn.benibix.com/term/ai/model-weights)
- [GGUF](https://learn.benibix.com/term/ai/gguf)
- [Hugging Face](https://learn.benibix.com/term/ai/hugging-face)
- [Open-Weight Model](https://learn.benibix.com/term/ai/open-weight-model)
- [Model Hub](https://learn.benibix.com/term/ai/model-hub)
- [Supply Chain Attack](https://learn.benibix.com/term/development/supply-chain-attack)

## Told apart from

- [Safetensors vs GGUF](https://learn.benibix.com/compare/safetensors-vs-gguf): People think safetensors and GGUF are just two names for the same kind of model file. They are made for different jobs. Safetensors holds the full weights, most often at 16 bits, and it is how most models are shared on hubs. GGUF packs a model for local apps, most often shrunk to fewer bits. You often turn the first into the second.

![Four layers of a local AI setup, top to bottom. A chat screen, such as Open WebUI or Jan. An OpenAI-compatible API on the same machine, at an address like localhost:11434/v1. A runtime that runs the model, such as Ollama, llama.cpp, LM Studio, Jan or MLX. And the weights file it loads, as GGUF or safetensors. Under it all sits your own hardware.](https://learn.benibix.com/diagrams/ai4-local-stack.svg)

---

Source: https://learn.benibix.com/term/ai/safetensors
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
