Open PYC files in your browser

A Python module compiled to bytecode. See which Python made it, what it imports, its functions and its disassembled bytecode, right here, without running it. Nothing leaves your device.

Or drop it anywhere on this page

What you'll see

Your .pyc opens as the module it holds, its bytecode disassembled without running any of it.

billing.cpython-312.pyc

Python 3.12 • 38 functions • 14 KB

  • The Python that made it • When its source was compiled
  • Functions and classes • Their arguments
  • Bytecode as dis lists it • Python 2.7 and 3.6 to 3.15
  • Nothing in it runs • Read as data only

About PYC

A .pyc is a Python module compiled to bytecode. Python writes one into a __pycache__ folder the first time it imports a module, named after the Python that made it, like inventory.cpython-312.pyc, so later imports skip compiling. Apps shipped without their source, like many built with PyInstaller, carry only .pyc files.

It starts with a magic number that names its Python version, then its source's time and size, or the source's hash, then the module's code object in marshal's format: its bytecode, constants and names, with each function's code object inside. The bytecode changes with every release, so a .pyc only loads in the Python that wrote it. Python 2 named its optimized bytecode .pyo.

Filepeek reads it without running any of it: the Python it's for, when its source was compiled, the modules it imports, every function and class with its arguments, its strings, and the bytecode disassembled as Python's own dis module lists it, for Python 2.7 and 3.6 to 3.15.

Python compiled bytecode

Format

MIME type
application/x-python-code
Made by
Python Software Foundation
Released
1991

Inside the file

Header
Magic number, time or hash
Code
Code objects in marshal's format
Bytecode
One Python version's
Made by
Python, on import

Opens in every browser

Filepeek disassembles a .pyc in Chrome, Edge, Firefox and Safari. On their own, browsers download .pyc files, and reading one usually takes Python's dis module or a decompiler.

  • YouChromeOpens through Filepeek
  • YouEdgeOpens through Filepeek
  • YouFirefoxOpens through Filepeek
  • YouSafariOpens through Filepeek

Apps that open PYC

  • WindowsPython runs it in a terminal, once installed • No app shows it
  • MacPython runs it in Terminal, once installed • No app shows it
  • iPhone and iPadNo app opens it
  • AndroidNo app opens it

Questions

Which Python version made this .pyc?

Its first two bytes, the magic number, say. Filepeek names the version, like Python 3.12 for magic number 3531, and its name in a __pycache__ folder says it too, as in cpython-312.

Can I get the source code back from a .pyc?

Only roughly. Its comments and layout are gone, but its names, strings and bytecode remain. Filepeek shows those with the disassembly, and decompilers like pycdc or decompyle3 write Python again from them, best for older versions.

Why does Python say bad magic number?

The .pyc was written by a different Python than the one loading it, and each release changes the bytecode. Deleting __pycache__ makes Python compile the source again, when the .py is there.

Is it safe to open a .pyc?

In Filepeek, yes: its bytes are read as data and nothing runs. Importing it with Python runs the module's code, so a .pyc from someone you don't know shouldn't be imported.

More application formats

All supported file types

Tell us what happened

Where the file came from helps us most

With itNever the file or its name
Thank you

Opens in a new tab

Keys

Everywhere

EXIF

Verify

License

Signature