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.
What opens 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.
Windows
- Python (numpy.load)
- Spyder
- Jupyter
macOS
- Python (numpy.load)
- Spyder
- Jupyter
Linux
- Python (numpy.load)
- Spyder
- Jupyter
Open a .npy file step by step
- Confirm the file really is a .npy. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with Python (numpy.load) or Spyder.
- On Mac, use Python (numpy.load) or Spyder.
- On Linux, try Python (numpy.load) or Spyder.
- Still stuck? Convert the .npy to CSV, which opens more widely.
Why can't I open my .npy file?
Almost always because no installed app understands NPY. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .npy at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
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.
What is the .npy file signature (magic bytes)?
A .npy file starts with the hex bytes 93 4E 55 4D 50 59, which read as .NUMPY in ASCII. Programs identify NPY by those bytes, not by the filename, so a renamed file still gives itself away.
These are the documented signatures for NPY. For a full breakdown, see the NumPy array file signature page.
| Hex signature | Offset | ASCII | Note |
|---|---|---|---|
| 93 4E 55 4D 50 59 | 0 | .NUMPY | 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. How sources are ranked and what is deliberately left out is set out in the methodology.