PYC PY
File conversion

Convert PYC to PY

QUICK ANSWER
Is it possible to convert PYC to PY?
Yes - PYC converts to PY.

Use decompyle3 or uncompyle6 for Python 3.8 and earlier, or pycdc for Python 3.9 and newer. The recovered .py file will be logically similar to the original but stripped of comments, original formatting, and possibly some docstrings.

Also to PY: KGL · UI · PYO

On this page

Tested on macOS, Windows & Linux
Last verified Oct 2026

More free converters

HEIC, PNG, WEBP, MP3 and more - every tool here is free.

Open the toolbox

Why convert PYC to PY?

The main reason is source recovery when the original .py was deleted or never provided alongside the bytecode. A secondary use is auditing programs distributed as bytecode-only. This is decompilation rather than a clean format conversion - a .pyc stores compiled bytecode and the original source text is not preserved inside it.

How to convert PYC to PY

decompyle3 FREE

Install with pip install decompyle3 and run decompyle3 yourfile.pyc > recovered.py. Supports Python 3.7-3.8.

uncompyle6 FREE

Install with pip install uncompyle6 and run uncompyle6 yourfile.pyc > recovered.py. Handles Python 2.x through 3.8.

pycdc OPEN-SOURCE

Download the binary from github.com/zrax/pycdc and run pycdc yourfile.pyc > recovered.py. Best option for Python 3.9 and newer, though accuracy on 3.11+ is limited.

About these formats

Quality & what to watch

  • Comments are permanently gone - Python bytecode does not store them; no tool can recover them from a .pyc regardless of Python version.
  • Decompilation accuracy drops sharply for Python 3.9 and above; pycdc is the best-effort option for newer bytecode but may produce incomplete output.
  • If the .pyc was obfuscated, decompilation will fail or return blank output; python3 -m dis yourfile.pyc can still show individual bytecode instructions as a fallback.

Frequently asked questions

How do I know which Python version compiled the .pyc?
Since Python 3.2, .pyc files in __pycache__ are named like module.cpython-311.pyc - the number indicates the Python version that compiled it.
Do docstrings survive decompilation?
Sometimes - if the original code stored a docstring as a string constant it may appear in the output, but it is not guaranteed.
What if the decompiler produces errors or blank output?
The .pyc may be obfuscated or from an unsupported Python version; try a different tool or use python3 -m dis to inspect individual bytecode instructions.