.PICKLE

PICKLE File

Python Pickle Serialization File
Ask a question
QUICK ANSWER

A PICKLE file stores a serialized Python object - a trained ML model, dataset, or data structure - created by Python's built-in pickle module. Open it with Python: import pickle; data = pickle.load(open('file.pickle', 'rb')). Never load a pickle file from an untrusted source; it can execute arbitrary code on your machine.

Developer: Python Software Foundation Category: Developer Files Open standard MIME: application/octet-stream
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jul 14, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the PICKLE file format?

Files with the .pickle extension store Python objects serialized using the pickle module, Python's built-in object serialization library. Both .pickle and .pkl are interchangeable extensions for the same format; .pickle is the longer explicit form while .pkl is the compact three-character variant in use since Python 1.x.

Contents of Python Pickle files

Serialized objects in .pickle files can be of any Python type. .pickle files are used to serialize database objects, cache machine-learning model weights, or store program state between runs. Only .pickle files from trusted sources should be used, as such files can contain malicious software - deserializing an untrusted pickle can execute arbitrary Python code. Pickle objects can be compressed externally using gzip, bz2, or lzma.

How are Python PICKLE files created?

The serialization process is called "pickling" and is done using dump() and dumps() methods. The dump() method is used for serializing an object into a file, while dumps() saves the object as a bytes object. Deserialization - converting the byte stream back to the original object - is done using load() and loads(); this process is referred to as "unpickling".

The pickle protocol version controls the binary format. Protocol 0 is human-readable ASCII; Protocols 1-5 are progressively binary, with Protocol 5 (Python 3.8+) adding out-of-band buffers for efficient handling of large .NPY arrays. In machine-learning workflows, .pickle is widely used to persist scikit-learn models and PyTorch checkpoints, though SafeTensors is gaining adoption as a safer alternative for model weights specifically.

Security & safety

RISK: HIGH

CRITICAL WARNING: Pickle files can execute arbitrary Python code when loaded. A malicious .pickle file can delete files, download malware, or take over a system. Never load a pickle file from an untrusted source. In ML/AI workflows, malicious pickles in model repositories (Hugging Face Hub, GitHub) are an active threat vector. Use picklescan to scan files before loading, or switch to SafeTensors format for model weights. CVE-2025-1889: picklescan < 0.0.22 could be bypassed by using non-standard file extensions within archive-based model packages.

Format details

in a nutshell
FULL NAMEPython Pickle Serialization Fileaka Python Pickle file, pickled object file
DEVELOPERPython Software Foundationsince 1994 (Python 1.1; pickle module first released)
MIME TYPEapplication/octet-stream
TYPEbinary serialization format
STANDARDOpen · royalty-free
MAGIC BYTES · FILE SIGNATURE
OFFSET
0001
HEX
8005
ASCII
··
Magic byte varies by protocol: \x80\x00 (proto 0, human-readable), \x80\x02 (proto 2, Python 2.3+), \x80\x03 (proto 3, Python 3.0+), \x80\x04 (proto 4, Python 3.4+), \x80\x05 (proto 5, Python 3.8+). Protocol 0 has no binary magic - it is human-readable ASCII opcodes. All binary protocols start with opcode 0x80 followed by the protocol version byte.

Programs that open PICKLE files

Windows3 apps
Python Open-source python -c "import pickle; import pprint; pprint.pprint(pickle.load(open('file.pickle','rb')))" - prints the deserialized object. Use only with trusted files.
VS Code (with Python extension) Free Open a Python terminal, import pickle, and load the file interactively in a Jupyter notebook or Python REPL.
Jupyter Notebook / JupyterLab Open-source In a notebook cell: import pickle; data = pickle.load(open('file.pickle','rb')); print(data)
macOS1 app
Python Open-source python3 -c "import pickle; print(pickle.load(open('file.pickle','rb')))"
Linux1 app
Python Open-source python3 -c "import pickle; print(pickle.load(open('file.pickle','rb')))"

Technical details

deep spec
File encodingBinary (protocols 1-5); human-readable ASCII opcodes (protocol 0)
Magic bytes0x80 followed by protocol version byte; e.g. 0x80 0x05 for protocol 5 (Python 3.8+); protocol 0 has no binary magic
Pickle protocols0 (ASCII, Python 1.x); 1 (binary, Python 1.x); 2 (new-style classes, Python 2.3+); 3 (bytes, Python 3.0+); 4 (objects >4 GB, Python 3.4+); 5 (out-of-band buffers, Python 3.8+)
Default protocolProtocol 5 is the default in Python 3.8 and later
CompressionNone built-in; commonly wrapped externally in gzip, bz2, or lzma; joblib adds its own compression layer
EncryptionNone - no built-in encryption; encrypt at the filesystem or wrapper level if needed
Typical file sizeUnder 1 MB for model configs; 1 MB - several GB for ML model weights and large datasets
Security riskDeserializing untrusted pickle data can execute arbitrary Python code via __reduce__ hooks - never unpickle files from untrusted sources
Internal structureStream of pickle opcodes encoding Python objects recursively; Protocol 4+ uses frames for chunked streaming; Protocol 5 adds out-of-band buffers for zero-copy of large arrays
MIME typeapplication/octet-stream (formally); application/x-pickle (informal)
Cross-platformPlatform-independent; runs on any Python-supported OS (Windows, Linux, macOS)
Serialization APIdump() and dumps() for pickling; load() and loads() for unpickling
ML/AI usagePrimary serialization format for scikit-learn models and PyTorch checkpoints; SafeTensors is gaining adoption as a safer alternative for model weights
Released1994 (Python 1.1; pickle module first released)
Latest versionProtocol 5 (Python 3.8, 2019); default protocol 5 from Python 3.14
Open standardYes · royalty-free
Specificationdocs.python.org

PICKLE conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with PICKLE files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about PICKLE files.

Frequently asked questions

How do I open a .pickle file?
Use Python: import pickle; data = pickle.load(open('file.pickle', 'rb')). Only load files from trusted sources - pickle can execute arbitrary code.
What is the difference between .pickle and .pkl?
They are the same format with different extensions. .pkl is more common in practice; .pickle is the full word. Python's pickle module accepts both.
Are pickle files safe to open?
Only if you trust the source. Pickle is inherently unsafe with untrusted data - loading a malicious pickle file can execute arbitrary code on your machine. For ML models from unknown sources, scan with picklescan first.
Can I convert a pickle file to JSON?
Only if the pickled object contains JSON-compatible types. Use Python: json.dump(pickle.load(open('file.pickle','rb')), open('out.json','w')). Complex objects (NumPy arrays, class instances) require custom serializers.
What Python protocol should I use when saving a pickle?
Use protocol=5 (Python 3.8+) for best performance with large data, especially NumPy arrays. Use protocol=2 if you need Python 2 compatibility. Specify with pickle.dump(obj, f, protocol=5).
Why is my pickle file large?
Pickle stores the full object graph including class metadata. For NumPy arrays or ML model weights, use compressed formats: pickle.dump(obj, gzip.open('file.pkl.gz','wb')) or switch to SafeTensors/HDF5.
Can I open a pickle file in Excel or a spreadsheet?
Not directly. If the pickle contains a pandas DataFrame, export it to CSV first with Python: df.to_csv('out.csv').

References

1Python docs - pickle moduledocs.python.org
2PEP 3154 - Pickle Protocol 4peps.python.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.JPGJPEG Image
4.PARTPartial Download File
5.RPMSGRestricted Permission Message
6.DATProgram Data File (generic)
7.MDMarkdown Document
8.EXEWindows Executable (Portable Executable)
9.BINCD/DVD Disc Image (BIN/CUE)
10.DBSQLite Database File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z