PYC

pyc icon

Version-specific compiled Python bytecode used by the Python interpreter

File type: Source code and script file

A .pyc file contains compiled Python bytecode generated from a Python source module. Python commonly creates these files automatically when importing or running .py files, usually storing them in a __pycache__ directory.

These files are intended for loading by a compatible CPython interpreter rather than for direct editing. Bytecode can also be examined or partially reconstructed with Python disassemblers and decompilation tools.

What is pyc file?

File type category:
Source code and script file

Date updated: October 11, 2026

Format details

A compiled Python file contains a version-specific header followed by serialized code objects and related data. The header includes a magic number identifying the bytecode format, together with metadata such as a source timestamp or hash, depending on the Python version and compilation mode.

Compatibility

Python bytecode is generally tied to the interpreter implementation and version that produced it. A file created by one Python release may not run on another release, so the matching or compatible CPython version is normally required. The format can be used on Windows, macOS, and Linux when the appropriate interpreter, dependencies, and module paths are available.

Creation and contents

Python creates bytecode automatically during imports, or it can be generated explicitly with python -m compileall. Modern Python versions normally use version-specific filenames inside __pycache__. A compiled file does not preserve the original comments, formatting, or exact source text, and it may contain optimized code objects.

Inspection and decompilation

Python's dis module can disassemble compatible bytecode, while tools such as uncompyle6 and decompyle3 can attempt to reconstruct source-like Python code. Decompilation may be incomplete or inaccurate, particularly for unsupported Python versions, optimized or obfuscated files, and code generated dynamically.

How to open pyc file?

To use a .pyc file, install the Python version that matches its bytecode format and run the containing module or package through that interpreter. Python loads the file when the module is imported, provided that its location, package structure, and dependencies are correct. A bytecode file is not normally opened as a standalone document.

CPython is available for Windows, macOS, and Linux. For inspection, use the compatible Python dis module or a decompiler such as uncompyle6 or decompyle3. Avoid uploading private bytecode to online viewers because it may reveal proprietary program logic.

How to convert pyc file?

There is no standard general-purpose conversion from Python bytecode to another application format. To create a new compatible compiled file, obtain the corresponding .py source and run it with the intended Python interpreter, or use python -m compileall. The generated bytecode must be produced for the target Python version.

Tools such as uncompyle6 and decompyle3 can decompile some files into source-like Python code, but the result may require manual correction and is not guaranteed to match the original. Online converters may offer limited version support; desktop tools are generally safer for confidential files.

Suggested software to open pyc file:

Associated software actions with the pyc file

Software applications that can open pyc files:

Microsoft Windows

Software applications that can edit pyc files:

Microsoft Windows

Software capable of saving pyc files:

Microsoft Windows

Software apps that create pyc files:

Microsoft Windows

Software applications that handle other tasks involving pyc files:

Microsoft Windows

Convert .pyc files

Convert .pyc to other formats
Convert to .pyc from other formats

Related file extensions