Python Decompiler

Python Decompiler Online

Decompile PYC and PYO bytecode, or extract PYZ archives and Python zipapps.

.pyc .pyo .pyz
Drop your PYC, PYO, or PYZ file here

⚠ Drag-and-drop upload could not load — an ad blocker is most likely blocking it. Please disable your ad blocker and reload the page to upload a file.

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.

How It Works

1

Upload

Drag and drop your .pyc, .pyo, or .pyz file or click to browse.

2

Decompile

The appropriate tool decompiles bytecode or extracts archive contents.

3

Browse

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.

What is a PYC File?

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.

PYC File Structure

A PYC file contains:

PYZ Files: Two Formats, One Extension

A .pyz upload is one of two unrelated things, and this service decides which from the file's own bytes rather than its name.

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.

PYC vs PYO Files

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.

How Python Decompilation Works

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.

Common Uses for Python Decompilation

Python Packaged as an Executable

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.

Frequently Asked Questions

What is a PYC file?

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.

What is the difference between PYC and PYO files?

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.

Which Python versions are supported?

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.

What is a PYZ file?

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.