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
def greet(name):
    return f"Hello, {name}!"

print(greet("World"))
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 entirely in your browser — your source is never uploaded. 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.

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.

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.