.PYD

PYD File

Python extension module (Windows)
Ask a question
QUICK ANSWER

A .pyd file is a compiled Python extension module for Windows - technically a DLL containing native C/C++ code that Python imports like a regular module. You do not open it directly; Python loads it automatically when you use a package that needs it. If you see an "ImportError: DLL load failed" error, reinstall the package with pip for your exact Python version and architecture.

Developer: Python Software Foundation (CPython); built on Microsoft's PE/DLL format Category: Developer Files Open standard MIME: application/octet-stream
OPENS ON Windows
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jun 29, 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 PYD file format?

Python dynamic modules are saved as .pyd files on Windows systems. A .pyd file is a Windows DLL in PE (Portable Executable) binary format, distinguished by exporting a PyInit_<modulename> entry point that the interpreter calls on import. .pyd modules contain libraries that can be used by other Python applications; dynamic libraries allow faster code loading and application modularity. In contrast to .pyc and .pyo bytecode files, .pyd files are specific to Windows - the .so format serves the same role on Linux and macOS.

.pyd files contain compiled Python extension modules. Modules contain one or more namespaces, and Python programs that use such modules can refer to functions in those modules. Modules can be used by multiple Python applications. Modern builds include an ABI tag in the filename - for example, cp312-win_amd64.pyd - locking the file to a specific CPython version and bitness. Creating and distributing .pyd modules is typically handled by build tools such as Cython or setuptools.

Security & safety

RISK: MEDIUM

A .pyd is native executable code that Python runs in-process with no sandbox, so a malicious .pyd can do anything your Python program can. The practical risks: (1) a .pyd dropped into a folder Python searches can hijack an import (DLL/PYD search-order hijacking), and (2) downloading individual .pyd files from random sites to "fix" an error is a malware vector - always reinstall the proper package from PyPI with pip instead. .pyd files inside legitimate pip-installed packages are normal. Treat an unexpected, unsigned .pyd in Downloads or a project folder with suspicion and scan it.

Format details

in a nutshell
FULL NAMEPython extension module (Windows)aka Python dynamic module, Compiled Python extension
DEVELOPERPython Software Foundation (CPython); built on Microsoft's PE/DLL formatsince Late 1990s - Python on Windows has loaded extension modules from .pyd (a renamed .dll) since the Python 1.x/2.0 era
MIME TYPEapplication/octet-stream
TYPEWindows PE (Portable Executable) DLL exposing a Python init function - compiled binary
STANDARDOpen · royalty-free
MAGIC BYTES · FILE SIGNATURE
OFFSET
0001
HEX
4D5A
ASCII
MZ
A .pyd is literally a Windows DLL, so it begins with the MZ DOS stub and contains a "PE\0\0" (50 45 00 00) signature at the offset stored in e_lfanew (0x3C). It differs from an ordinary DLL only in that it exports a Python module-init function named PyInit_<modulename> (Python 3) or init<modulename> (Python 2). The DLL flag (bit 0x2000) is set in the COFF Characteristics field.

Programs that open PYD files

Windows4 apps
Python (CPython) - the loader Open-source You don't open a .pyd directly. Python imports it: 'import modulename'. If it fails, reinstall the owning package: 'pip install --force-reinstall packagename'.
pip (package manager) Open-source Reinstall/repair the package the .pyd belongs to for your exact Python version: 'pip install --upgrade --force-reinstall packagename'. Don't move .pyd files by hand.
Dependencies (lucasg) Open-source Diagnose 'DLL load failed': open the .pyd to see which dependent DLLs (e.g. a VC++ runtime) are missing on the system.
Ghidra Open-source For developers/reverse-engineers only: import the .pyd for full disassembly/decompilation of its native code (it's a PE binary).

Technical details

deep spec
Container formatWindows PE (Portable Executable) - the same binary container as `.dll` and `.exe` files
Magic bytes`MZ` (0x4D 0x5A) at offset 0 (DOS stub); PE signature at the offset stored at 0x3C
Byte orderLittle-endian
Key exported symbol`PyInit_<modulename>` (Python 3) or `init<modulename>` (Python 2) - CPython's import system calls this function to initialize the module
ABI filename tagVersion-tagged builds use the pattern `name.cpXYZ-win_amd64.pyd`; for example `cp312-win_amd64` targets CPython 3.12 on 64-bit Windows
PlatformWindows only; the Linux and macOS equivalent is a `.so` shared object
MIME type`application/octet-stream`; also registered as `application/vnd.microsoft.portable-executable`
Typical file size20 KB - several MB; large native libraries (e.g., NumPy or SciPy components) can reach tens of MB
CompressionNone - raw PE sections, no built-in compression
Code signingOptional Authenticode (PE) digital signature; integrity is otherwise unverified (native machine code)
Interpreter compatibilityMust match the exact CPython version, bitness (32/64-bit), and ABI tag; a mismatched file raises `ImportError` on import
Build toolchainTypically compiled from C, C++, or Cython source via setuptools `ext_modules`, CMake/scikit-build, or CFFI
ReleasedLate 1990s - Python on Windows has loaded extension modules from .pyd (a renamed .dll) since the Python 1.x/2.0 era
Latest versionTracks CPython; the per-version ABI tag (e.g. cp312-win_amd64) determines compatibility, current CPython 3.13 (2024)
Open standardYes · royalty-free
Specificationdocs.python.org

PYD conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with PYD 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 PYD files.

Frequently asked questions

What is a .pyd file?
A compiled Python extension module for Windows - technically a DLL containing native (usually C/C++) code that Python can import like an ordinary module. It's how fast packages such as NumPy ship their compiled parts.
How do I open a .pyd file?
You don't open it directly - it's compiled binary, not a script. Python loads it automatically when you import a package that uses it. To inspect it, a developer can disassemble it with Ghidra; to fix it, reinstall the owning package with pip.
How do I fix 'ImportError: DLL load failed' for a .pyd?
Usually the package was built for a different Python version/architecture, is missing a dependent runtime (install the Microsoft Visual C++ Redistributable), or is corrupt. Reinstall it for your exact Python: 'pip install --force-reinstall packagename', and make sure your Python bitness matches the package.
Is a .pyd the same as a DLL?
Yes - a .pyd uses the identical Windows PE/DLL format. The only difference is that a .pyd exports a Python module-init function (PyInit_<name>), which is what lets Python import it as a module.
Can I convert a .pyd to .py source code?
No. A .pyd is compiled machine code; the original Python/C source can't be recovered, only roughly disassembled. Get the source from the package's official repository instead.
Is a .pyd file a virus?
Not inherently - most .pyd files are legitimate parts of installed Python packages. But because it's native code Python runs without a sandbox, treat an unexpected .pyd (especially one downloaded to 'fix' an error) with suspicion; install packages only from PyPI via pip and scan unknown files.

References

1Python docs - Building C and C++ Extensions on Windowsdocs.python.org
2Python docs - Extending Python with C or C++docs.python.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.DATProgram Data File (generic)
5.BINCD/DVD Disc Image (BIN/CUE)
6.EXEWindows Executable (Portable Executable)
7.RPMSGRestricted Permission Message
8.NOMEDIAAndroid No-Media Marker File
9.MDMarkdown Document
10.TXTPlain Text 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