Decompile PYC and PYO bytecode, or extract PYZ archives and Python zipapps.
Working with Ren'Py? Use the RPYC decompiler for compiled scripts, the RPA extractor for game archives, or the read-only save and persistent inspectors for saved values.
Drag and drop your .pyc, .pyo, or .pyz file or click to browse.
The appropriate tool decompiles bytecode or extracts archive contents.
View the recovered source code or extracted files in your browser.
For packaged Python modules, type stubs, dependencies and native libraries in a .whl, use the Python Wheel Viewer and WHL Extractor. It preserves package contents without installing them.
PYC stands for Python Compiled. When Python imports a module, the interpreter compiles the source code (.py file) into bytecode and caches the result as a .pyc file. This cached bytecode allows subsequent imports to skip the compilation step, improving startup time.
In Python 3, .pyc files are stored in __pycache__ directories with filenames that include the Python version (e.g., module.cpython-39.pyc). In Python 2, .pyc files were placed alongside the .py source files.
A PYC file contains:
A .pyz upload is one of two unrelated things, and this service decides which from the file's own bytes rather than its name.
PYZ\0 and holds one zlib-compressed module per entry — nearly the whole program of a frozen application. It is usually what is left over after unpacking an EXE. Each module is written out as a .pyc whose header carries the Python version that froze the archive, then decompiled where that version is supported.__main__.py at its root, sometimes preceded by a #! line so it runs like a script. It normally contains real .py source, which is preserved exactly as packaged rather than regenerated; anything compiled without a packaged counterpart is decompiled alongside it.The result keeps recovered source under sources/, bytecode under pyc/ and anything else the archive carried under resources/, so nothing is lost even when a module cannot be decompiled. Extraction works for every Python version; source recovery is limited by the bytecode decompiler, and a version it cannot read is named in the notes instead of being turned into misleading source. Nothing in the archive is ever imported or executed — __main__.py is treated as an ordinary file.
PYO (Python Optimized) files were created when running Python with the -O flag, which removed assert statements and __debug__ code. In Python 3.5 (PEP 488), PYO files were deprecated and replaced by PYC files with optimization level suffixes like .cpython-39.opt-1.pyc.
Both PYC and PYO files contain the same type of bytecode and can be decompiled using this tool. The optimization level does not affect decompilation — only the removed assertions and debug code will be missing from the output.
Python bytecode retains significant information about the original source code — variable names, function signatures, docstrings, line numbers, and code structure are all preserved. This makes Python decompilation much more effective than decompiling native code.
The decompiler reads the marshalled code object from the PYC file, analyzes the bytecode instructions, reconstructs control flow (if/else, loops, try/except), and generates Python source code that produces identical bytecode when recompiled.
For an Android app built with Kivy, BeeWare or Chaquopy, use the Python APK decompiler to recover bundled Python alongside the Android source and resources.
If the bytecode is inside a Windows EXE, Linux executable, or macOS app built with PyInstaller or py2exe, upload the whole file to the PyInstaller decompiler. It unwraps the executable first, preserves the recovered .pyc files, and then runs this Python bytecode decompiler on each module.
A PYC file is compiled Python bytecode. When Python imports a module, it compiles the .py source to bytecode and caches it as a .pyc file in the __pycache__ directory for faster subsequent imports.
PYO files were compiled with Python's -O optimization flag, removing assert statements. In Python 3.5+, PYO files were replaced by PYC files with opt-1 or opt-2 suffixes. Both can be decompiled by this tool.
This tool supports Python bytecode from versions 2.1 through 3.8. The decompiler automatically detects the Python version from the magic number in the PYC file header.
Two unrelated formats share the extension: a PyInstaller PYZ archive, which is the compressed module store inside a frozen application, and a PEP 441 zipapp, which is an ordinary ZIP with __main__.py at its root. Both are accepted, and they are told apart from their contents rather than their name.