.SAFETENSORS file extension
To open .SAFETENSORS files on Windows, install Python, then install the library: pip install safetensors.
To open a .safetensors file, use software that can load SafeTensors checkpoints—most commonly Python with the Hugging Face safetensors library. These files are not meant to be “opened” like documents; they are model weight containers that you load into ML frameworks such as PyTorch via the safetensors APIs.
Last updated: June 12, 2026
Open on your device
Choose your operating system for a dedicated step-by-step opening guide.
How to open .SAFETENSORS files
Use these platform-specific instructions to open .SAFETENSORS files safely.
Windows
- Install Python, then install the library: pip install safetensors
- Load the file in a Python script using the safetensors APIs (for example, use safetensors.torch.load_file for PyTorch tensors)
Mac
- Install Python, then install the library: pip install safetensors
- Load the file in a Python script using the safetensors APIs (for example, use safetensors.torch.load_file for PyTorch tensors)
Linux
- Install Python, then install the library: pip install safetensors
- Load the file in a Python script using the safetensors APIs (for example, use safetensors.torch.load_file for PyTorch tensors)
iOS
- There is no common iOS-native app support cited for SafeTensors; if you need to inspect or use the file, transfer it to a desktop and load it with Python (safetensors).
Android
- There is no common Android-native app support cited for SafeTensors; if you need to inspect or use the file, transfer it to a desktop and load it with Python (safetensors).
Security notes
- SafeTensors is designed to store tensor data and metadata (JSON header + raw bytes) rather than executable serialization logic; this is intended to reduce risks associated with pickle-based model checkpoints.
- Even with a safer container, treat untrusted model weights as potentially harmful at the application level (e.g., adversarial or poisoned weights). Safe parsing is not the same as safe model behavior.
- The implementation has been reviewed by a third party (Trail of Bits) focusing on validation and safety properties; still, keep parsers updated and avoid using unknown forks or unmaintained loaders.
If you did not expect this file
This extension is usually plain data, text, or structured content—not a program by itself. The practical risk is social engineering (a scam attachment or misleading filename). For trusted senders you rarely need heavy-handed antivirus wording; use these tools when you want an extra check on unexpected downloads.
Avast offers free and premium antivirus software that protects against viruses, malware, ransomware, and phishing. Scan files before opening them to ensure safety.
NortonNorton 360 delivers comprehensive antivirus protection, VPN, and identity theft monitoring. Scan files for threats before opening to keep your device secure.
We may earn a commission when you use affiliate links. This supports our free file extension guides.
Can't open this file?
These are the most common causes and fixes when .SAFETENSORS files fail to open.
Common reasons
- Tried to open it in a text editor and it looks like gibberish
- Load fails due to incompatible dtype/shape expectations
- The file downloads but tools report it as corrupted or incomplete
Fix steps
- Use a SafeTensors-aware loader (commonly Python + safetensors) instead of a text editor
- If you only need metadata, read just the header using the documented metadata parsing approach (header JSON at the start of the file)
What is a .SAFETENSORS file?
SafeTensors is a binary file format for storing one or more tensors. The layout is: an 8-byte little-endian header length, a UTF-8 JSON header describing tensors (dtype, shape, data_offsets) and optional reserved metadata, followed by the raw tensor byte data. The design goal is safe and efficient loading (including zero-copy/lazy patterns) by using explicit offsets and a constrained header structure.
Background
SafeTensors is widely used to distribute and load neural network weights, particularly alongside Hugging Face tooling and model repositories. Instead of relying on Python pickle-based formats (which can execute code on load), SafeTensors stores only tensor metadata plus raw bytes, enabling stricter validation and safer parsing approaches.
Internally, the header is JSON that maps tensor names to descriptors containing dtype, shape, and byte ranges (data_offsets) into the raw data section. A reserved "__metadata__" entry can store key/value metadata; ecosystem standards (for example, model metadata conventions) may define expected keys.
Because the header is small and located at the start, it can be read without downloading the entire file (for example via HTTP Range requests). This makes it practical for large checkpoints hosted remotely: tools can inspect metadata first, then selectively download or memory-map the tensor payload when supported.
Further reading
Authoritative resources for more details on the .SAFETENSORS format.
- SafeTensors README (format layout and design goals)
- safetensors on PyPI (Python usage and APIs)
- Hugging Face docs: Metadata Parsing (Range requests and header structure)
- Stability AI Model Metadata Standard (metadata keys for __metadata__)
- Trail of Bits security review of SafeTensors (PDF)
- IANA Media Types registry (to verify registered MIME types)
Common .SAFETENSORS issues
Tried to open it in a text editor and it looks like gibberish
.safetensors is a binary format: only a small header is JSON text; the majority is raw tensor bytes.
- Use a SafeTensors-aware loader (commonly Python + safetensors) instead of a text editor
- If you only need metadata, read just the header using the documented metadata parsing approach (header JSON at the start of the file)
Load fails due to incompatible dtype/shape expectations
The header encodes dtype and shape per tensor; a consuming script/model may expect different tensor names or shapes than those stored in the file.
- List tensor names and their dtype/shape from the header metadata before loading into your model
- Ensure you are loading into the correct model architecture and that tensor naming matches what the model code expects
The file downloads but tools report it as corrupted or incomplete
SafeTensors relies on exact byte offsets (data_offsets). A truncated download or partial copy can break header/data consistency and validation.
- Re-download or re-copy the file, ensuring the transfer completes fully
- If reading remotely, ensure your HTTP client supports Range requests correctly when doing partial header reads
FAQ
Is a .safetensors file just JSON?
No. Only the header is UTF-8 JSON; the tensor contents are stored as raw binary bytes after the header.
Can I extract tensors without downloading the whole file?
Often, yes for metadata: the header can be read from the beginning of the file, and the official docs describe parsing metadata via HTTP Range requests to fetch only the initial bytes needed for the header.
Where is model metadata stored in SafeTensors?
Metadata can be stored in the reserved "__metadata__" portion of the JSON header; ecosystem specifications (such as Stability AI’s model metadata standard) may define conventions for keys.
Is there an official registered MIME type for .safetensors?
The IANA media types registry is the authoritative place to check; the provided IANA registry source does not list a specific registered media type for .safetensors.
Similar file extensions
Compare related formats in the same category to find the right tool faster.