Skip to main content
Security Module

Python Marshal Encryptor

Compile Python to version-locked marshaled bytecode with optional zlib or zstd compression and get a ready-to-run loader. Target Python 3.10–3.14. Runs 100% in your browser.

Why use this tool?

Use the Marshal Encryptor when you want to ship Python as bytecode instead of readable source. It compiles your script under the exact CPython version you choose (3.10 through 3.14) and returns a single self-contained loader that runs your code from a marshaled, base64-encoded blob — no readable .py in sight. Compress the blob with zlib (works on every version) or zstd (3.14+, smaller on larger payloads), and pick an optimize level to strip asserts (-O) or asserts and docstrings (-OO).

Advertisement
Source Code
The output is version-locked: marshaled bytecode built for Python 3.14 runs only on Python 3.14 (any micro-release). Run it on a different Python version and it will fail to load.
Marshaled Loader
# Your marshaled loader will appear here…

Runs in your browser. Note that marshaling is a light deterrent, not strong protection: bytecode can be decompiled back to near-source, and exec(marshal.loads(…)) can trip antivirus. For real protection, obfuscate with the Python Obfuscator first, then marshal the result.

Encoding isn't protection

"Marshal encryption" reverses — and so does a license check inside it.

A marshalled blob is just a code object the interpreter has to run, so it decodes right back to strings and logic — a hard-coded key or trial check comes straight out. Hiding a license check this way only slows someone down. Licers keeps the decision on a server (Ed25519-signed, device-bound), so a recovered or patched client still can't produce a valid license.

Add real licensing, free

Tool facts

Supported Python
Python 3.10 – 3.14 (default 3.14)
Input limit
Limited only by your device
Last reviewed
2026-08-24

What it can't do

  • Encrypt your code — marshal is a binary encoding, not encryption.
  • Stop a determined reverse-engineer on its own (pair it with obfuscation).
  • Produce output that runs on a Python version other than the one you select.

About Python Marshal Encryptor

Marshaling serializes a compiled Python code object into raw bytecode. Because Python's bytecode format changes between minor versions, the output is version-locked: a blob built for Python 3.12 only loads on Python 3.12. This tool loads the matching CPython runtime (via Pyodide) for whichever version you pick — 3.10, 3.11, 3.12, 3.13 or 3.14 — so the bytecode magic is always correct for your target.

Compression tunes the output. zlib wraps the marshaled bytecode in zlib.compress() (the loader decompresses it at import time) and ships in every CPython standard library, so it stays portable across versions. zstd uses the new compression.zstd module — it's smaller than zlib on larger payloads (a few percent, widening with size), but because compression.zstd is standard-library only on Python 3.14+, the zstd loader runs only on 3.14+, so selecting it targets Python 3.14. The optimize level maps to compile()'s optimize argument: level 1 (-O) removes assert statements, level 2 (-OO) also strips docstrings — both make the bytecode leaner.

Important: marshaling is a lightweight deterrent, not strong protection. Compiled bytecode can be decompiled back to near-original source with free tools like decompyle3 or pycdc, and antivirus engines sometimes flag exec(marshal.loads(...)) loaders. Zlib compression obscures the blob a little but is trivially reversible. For meaningful protection, obfuscate your source first with the AST obfuscator, then marshal the result.

Go deeper: how Python marshal works explains the format, and reversing marshal-obfuscated bytecode shows step by step why it's only a deterrent.

Frequently Asked Questions

Python 3.10, 3.11, 3.12, 3.13 and 3.14. Pick your target in the dropdown; the tool loads the matching CPython runtime so the bytecode magic number is correct for that version.