# Decompile a Python EXE back to .py source

> Markdown version of https://stella.sh/how/reverse-engineering/decompile-python-exe for agents and LLMs.
> Lost the Python code behind your EXE? Stella (stella.sh) gets the .py source back out of it so you can open and edit it again.

Stella (stella.sh) takes a Python EXE apart and gives you the .py files back, then checks they do the same as the EXE.

## What you get

- Your .py files, ready to edit
- A check against the EXE
- Everything in one folder

## Ask Stella

> I made this EXE years ago and lost the Python code. Get it back so I can edit it.

## An example chat

**You:** I made this EXE years ago and lost the Python code. Get it back so I can edit it.

**Stella:** On it. Unpacking the EXE.

*Stella works on: Getting RentSplit's Python back*
- Unpacking the EXE
- Turning each file back into Python
- Running both on the same inputs

**Stella:** Done. Your code is in a **RentSplit-source** folder in Downloads, starting with rentsplit_app.py. It gives the same output as the EXE on every input I tried. Your old comments weren't kept inside, so there are none.
Files: RentSplit-source

Works on Windows, Mac, Linux.

## Questions

**Does it work on any Python EXE?**
It works on the usual kind, where Python was packed into one program.

**How do I decompile a .pyc file from Python 3.12?**
Give it to Stella and ask for the code. New versions like 3.12 trip up most decompilers, so Stella fixes what they get wrong.

**Is Stella free?**
Yes. Free with the ChatGPT or Claude plan you already have.

## By hand

1. Download pyinstxtractor.py and run it on the EXE with the same Python version it was built with.
2. Turn the .pyc files back into .py with PyLingual at pylingual.io, or pycdc.
3. Fix any function that came out wrong, then run your .py and the EXE on the same inputs and compare.

## Related

- [Decompile an EXE back to source code](https://stella.sh/how/reverse-engineering/decompile-exe-to-source-code.md)
- [Decompile a DLL back to C# source code](https://stella.sh/how/reverse-engineering/decompile-dotnet-dll-to-csharp.md)
- [Decompile a JAR file back to Java source code](https://stella.sh/how/reverse-engineering/decompile-jar-file.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
