Python Obfuscator (Max)

A seven-layer Python obfuscator that runs real CPython in your browser through Pyodide. It strips comments, docstrings and type hints, renames names to look-alike X/x blobs, turns strings into chr() chains or base64, rewrites integers as hex arithmetic, packs the source with zlib and base64, nests that pack up to 8 times and finishes with an XOR wrap. Show Work lists every layer with its size before and after, and Verify runs both versions and compares their output.

Tool Web & Dev Updated Oct 3, 2026
Learn how this works
How to Use
  1. Paste a Python module into the Input box. The Input readout shows its size in bytes as you type.
  2. Tick the layers you want and pick a wrap depth (x1 to x8), or press Max Security for all seven layers at depth x3. The Resistance readout updates as you go.
  3. Press Obfuscate. The first press downloads Pyodide, CPython compiled to WebAssembly, from jsDelivr; after that it comes from the browser cache.
  4. Read the Output and Growth readouts, then scroll to Show Work to see each layer, and each wrap pass, with its size before and after.
  5. Press Verify to run the original and the obfuscated code in Pyodide and compare what they print, then Copy or Download the .py file.
Input
Pyodide: not loaded
Obfuscation layers
Obfuscated output
Input
0 B
Output
—
Growth
—
Resistance
93/100

Worked Example

Strings and integers. Layer 3 turns any string of up to 24 characters into one chr() per character, so 'world' becomes (chr(119)+chr(111)+chr(114)+chr(108)+chr(100)), 46 characters instead of 7. Longer strings are base64-encoded instead. Layer 4 then rewrites every integer, including those five character codes, as arithmetic that evaluates back to it. Most often that is a subtraction around a random base between 0x1000000 and 0xFFFFFFF, written in hex; the rest are XOR chains. With the smallest base, 42 becomes 0X100002A - 0X1000000, which is 16,777,258 − 16,777,216 = 42.

Packing and wrapping. Layer 5 compresses the source with zlib at level 9 and base64-encodes it at 4 × ⌈n ÷ 3⌉ characters (1,000 bytes become 1,336). It then wraps the result in a loader whose names are themselves chr() chains: exec is written (chr(101)+chr(120)+chr(101)+chr(99)). Layer 6 repeats the pack on its own output, 3 times by default, and layer 7 XORs the result with a 12–24-byte random key. All seven layers at depth x3 score 6 + 12 + 14 + 8 + 22 + 15 + 16 = 93/100.

The common mistake: packing bytecode. Many packers compile the code and store marshal bytecode, but that only loads on the exact Python minor version that wrote it. A file packed under Pyodide’s Python 3.12 would fail on a user’s 3.11. This tool packs source, so the output runs on any Python 3. Press Verify before shipping to confirm the output prints exactly what the original does.

Show Work

Paste some Python and press Obfuscate to see every layer, and every wrap pass, with its size before and after.

The Seven Layers

1. Minify
comments, docstrings, type hints, blank lines removed
2. Rename
local names → 40–64 chars of X, x, Х, х; imports, builtins, attributes and dunders kept
3. Strings
≤ 24 chars → chr() chain; longer → base64; f-strings skipped
4. Integers
n → (base + n) − base, or XOR chains with random masks
5. Source pack
zlib level 9 → base64 → exec loader
6. Multi-layer wrap
layer 5 repeated 1, 2, 3, 5 or 8 times
7. XOR wrap
cᵢ = pᵢ XOR k[i mod K], K = 12–24 bytes
Base64 length
chars = 4 × ⌈bytes ÷ 3⌉
Resistance score
6 + 12 + 14 + 8 + 22 + min(22, 6 + 3 × depth) + 16, capped at 100

Unicode Names, zlib and Python in the Browser

The look-alike rename only works because of PEP 3131, which made non-ASCII identifiers legal in Python 3.0 (December 2008). Latin x (U+0078) and Cyrillic х (U+0445) are different names to Python, even though Unicode’s confusables list (UTS #39) flags them as visually identical. The pack layers use zlib, written by Jean-loup Gailly and Mark Adler and first released in 1995. Its DEFLATE format was published as RFC 1951 in 1996.

Pyodide began at Mozilla in 2018, where Michael Droettboom built it to run Python’s scientific stack inside the Iodide notebook, and became an independent project in 2021. Running real CPython means this tool parses with Python’s own ast module and rebuilds code with ast.unparse, so f-strings, decorators and nested quotes come out exactly as Python reads them.

About This Tool

This tool runs a seven-layer obfuscator written in Python inside Pyodide. Every transform works on the syntax tree rather than on raw text, so strings, keywords and attribute names are never mangled by accident. Imports, builtins, attributes, keyword arguments and dunder names are kept, so the module still imports and runs. Verify executes both versions with their printed output captured and reports whether it matches.

Everything runs in your browser. The only network requests are the Pyodide downloads on the first Obfuscate, and your code is not sent with them.

It is for developers who hand Python scripts to clients, for people building reverse-engineering challenges, and for anyone curious about how packers nest one layer inside another.

Related tools: JavaScript Obfuscator, Base64 Encoder, and Unicode Lab.

Frequently Asked Questions

Does my source code leave the page?

No. Pyodide 0.26.4 is the CPython 3.12 interpreter compiled to WebAssembly. Its files are downloaded from jsDelivr on the first Obfuscate, and your code is not sent with them. Parsing, every layer and Verify all run inside your browser tab.

Why does layer 5 pack source code instead of bytecode?

Bytecode made with marshal only loads on the Python minor version that wrote it, because every version has its own magic number and opcode set. Code packed by Pyodide’s Python 3.12 would refuse to load on 3.11 or 3.13. Layer 5 compresses the source with zlib at level 9, base64-encodes it and wraps it in an exec loader, so the result runs on any Python 3.

Are strings inside f-strings encrypted?

No. Layer 3 skips f-strings, because their literal parts must stay literal for the f-string to work. print(f'Hello, {name}!') keeps Hello, readable after layer 3. Layers 5 to 7 still pack the whole file, so the text is not visible in the final output, but write it as 'Hello, ' + name if you want layer 3 to cover it too.

Can the obfuscated code be turned back into source?

Yes, with effort. Each layer has to decode itself when the program runs, so the key and the decoder ship inside the file, and in 2001 Barak and six co-authors proved that no obfuscator can hide everything a program does. Obfuscation raises the cost of reading code; it is not encryption. Passwords and API secrets belong on a server, not in a script you hand out.

Why does the output grow so much?

Renaming swaps short names for 40–64-character blobs that average 78 bytes in UTF-8. A short string becomes one chr(n) per character, so 'world' (7 characters with its quotes) becomes 46. Every integer, including those chr codes, becomes hex arithmetic, and each wrap pass adds base64 (4 characters per 3 bytes) plus a loader. Show Work gives the exact size at every step.

How do I use the Python Obfuscator (Max)?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Do I need to install or sign up for anything?

Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.

Is my information private?

Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.

Common Use Cases

Ship a script to clients

All seven layers at depth x3 score 93/100 on the resistance scale.

Build a reverse-engineering puzzle

Depth x8 adds up to 8 nested packs; the score caps at 100/100.

Strip a file down

Layer 1 alone removes comments, docstrings, type hints and blank lines and shows the bytes saved.

Learn how packers work

Show Work lists the zlib and base64 sizes for every pass, so each layer of nesting is visible.

Check the result still runs

Verify runs both versions in Pyodide and compares everything they print, character for character.

Last updated: