What is a .npy file?
NumPy Array · Data · NumPy project · 2010
NPY is the native binary format for saving a single NumPy array from Python. It stores the raw numbers plus a small header describing the array's shape and data type, so it loads back exactly as it was saved.
What is a .npy file used for?
The file starts with the byte 0x93 and the text NUMPY, followed by a header giving the array's dtype, shape and memory order, then the raw array data. This makes saving and loading arrays fast and lossless.
Multiple arrays are bundled into a single .npz file, which is a ZIP of NPY entries. NPY is read almost exclusively with NumPy's load function.
How to open a .npy file
The .npy format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .npy file.
Windows
- Python (numpy.load)
- Spyder
- Jupyter
macOS
- Python (numpy.load)
- Spyder
- Jupyter
Linux
- Python (numpy.load)
- Spyder
- Jupyter
How to convert a .npy file
You can convert a .npy file to CSV, NPZ, Parquet using a conversion tool or the export menu of an app that opens it.
.npy file signature (magic bytes)
Programs recognise a .npy file by the bytes at the start of the file, not by its name. These are the signatures for NPY. For a full breakdown, see the NPY file signature page.
| Hex signature | Offset | Note |
|---|---|---|
| 93 4E 55 4D 50 59 | 0 | 0x93 + 'NUMPY' |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .npy file?
NPY is the native binary format for saving a single NumPy array from Python. It stores the raw numbers plus a small header describing the array's shape and data type, so it loads back exactly as it was saved.
How do I open an NPY file?
In Python, numpy.load('file.npy') returns the array. There is no general viewer; the file is meant to be read back into NumPy.
What is the difference between NPY and NPZ?
NPY holds one array. NPZ is a ZIP archive of several NPY files, letting you save many named arrays in one file.
Is loading an NPY file safe?
For numeric arrays, yes. Object arrays use Python pickling, which can run code, so only load object arrays from sources you trust.
Related formats
Sources
Details on this page were checked against authoritative references: