PyArmor vs Nuitka vs Cython vs Pyobfuscate: Python Code Protection Compared (Retested on Python 3.14)
They protect Python differently: Pyobfuscate rewrites source to be unreadable (free, no compiler, secret hidden); **PyArmor** obfuscates + adds a licensing runtime; **Cython** and **Nuitka** compile to native .pyd/.so (no bytecode to decompile, but string literals still leak). Retested in October 2026 on Python 3.14 with the same script: Pyobfuscate ~62 KB, PyArmor 5.4 KB + 628 KB runtime, Cython 42.5 KB, Nuitka 235 KB. Pyobfuscate and PyArmor hid the secret; Cython and Nuitka left it in plaintext, and Nuitka also wrote it into a .pyi stub file.
Every "protect my Python" thread names the same tools — PyArmor, Nuitka, Cython, PyInstaller, obfuscators — usually with marketing claims and little testing. So I ran the same 13-line script (a hard-coded secret + a license check + a compute loop) through each one and measured what actually comes out.
Retested 24 October 2026: PyArmor 9.2.8 (trial), Nuitka 4.3.1, Cython 3.3.0 and our current Pyobfuscate engine, all on Python 3.14.2 (Windows, MSVC 2022). Real sizes, real secret-leak checks, real run times. My first run in August (PyArmor 8.5, Nuitka 2.6, Cython 3.0 on Python 3.11) found the same pattern; what changed is listed at the end.
The three categories (this is the key)
Before the numbers, the distinction that resolves 90% of the confusion: these tools fall into three categories doing different jobs.
| Category | Tools | What it does |
|---|---|---|
| Obfuscator | Pyobfuscate, PyArmor | Rewrites source unreadable (stays Python) |
| Compiler | Cython, Nuitka | Turns Python into native machine code |
| Packager | PyInstaller | Bundles bytecode + interpreter (no protection) |
PyArmor also adds a licensing runtime, and PyInstaller is packaging only — I cover it in does PyInstaller protect source code?. The four below are the real protection contenders.
The tested results
Same input script for all four. The things that matter most: output size, does the secret leak (I byte-searched every output file for the hard-coded PYOB-2026-PRO-9f83kd) and run time (whole program, best of 3; the plain script took 0.23 s).
| Tool | Output | Secret in output? | Run time | Needs a compiler? |
|---|---|---|---|---|
| Pyobfuscate | ~62 KB obfuscated .py | Hidden ✓ | 0.65 s | No (pure Python) |
| PyArmor 9.2.8 | 5.4 KB script + 628 KB runtime .pyd | Hidden ✓ | 0.23 s | No (ships a runtime) |
| Cython 3.3.0 | 42.5 KB native .pyd | Leaks ✗ | 0.15 s | Yes (C compiler) |
| Nuitka 4.3.1 | 235 KB native .pyd (+ .pyi stub) | Leaks ✗ (twice) | 0.20 s | Yes (C compiler) |
The surprise for most people: Cython and Nuitka did NOT hide the secret. A plain byte search found PYOB-2026-PRO-9f83kd in both native .pyd files. Compilation hides your *logic* (there's no bytecode to decompile) but not your *string literals*. Only the two obfuscators encrypted the string.
New in this retest: Nuitka 4 writes a `.pyi` stub next to the module by default, and it lists your module constants in plain text. Mine contained the line SECRET = "PYOB-2026-PRO-9f83kd". If you ship that file, you ship the secret. Build with --no-pyi-file (or don't distribute the .pyi).
Pyobfuscate — free, no compiler, source stays Python
Our Python Obfuscator rewrites the source at the AST level — renaming, string encryption, control-flow flattening, junk — and returns runnable Python. My script came out ~62 KB with the secret encrypted, a tamper-locked watermark and no external dependency. Best for: fast, free source hiding with zero toolchain, or as a first layer before compiling. Trade-off: it's still bytecode, so it decompiles — to the obfuscated version, not your original — and the extra layers cost speed: on this tight 2-million-step loop it ran in 0.65 s vs 0.23 s for the plain script. For hot loops, turn off control-flow flattening or keep the heavy maths in a compiled module.
PyArmor — obfuscation plus a licensing runtime
PyArmor (9.2.8 trial) produced a tiny 5.4 KB stub that calls into a 628 KB `pyarmor_runtime.pyd` — the obfuscated script is a b'PY00...' blob decoded by that runtime. The secret was hidden, it ran correctly, and it was as fast as the plain script (0.23 s). Its real differentiator is licensing/DRM — expiration, trials, hardware binding — which the others don't do. Best for: commercial products needing license enforcement. Trade-off: the output depends on PyArmor's runtime, and full features are paid. See PyArmor vs Pyobfuscate and PyArmor free vs pro.
Cython — compile to native, strong logic protection
Cython compiled my module to a 42.5 KB native `.pyd` — the smallest compiled output — and was the fastest here (0.15 s vs 0.23 s, with the code unchanged). With C type declarations it goes much further: in a separate benchmark a typed numeric loop ran 56× faster than pure Python. There's no bytecode, so .pyc decompilers can't touch it. Best for: compiling the sensitive *modules* of an otherwise-normal Python project. Trade-off: needs a C compiler, is platform/version-specific (cp314-win_amd64), and — as the test showed — leaves string literals in plaintext.
Nuitka — compile the whole app to a binary
Nuitka (4.3.1) also compiled to native code; the .pyd was 235 KB — about 5.5× Cython's, because Nuitka bundles more of its own runtime and does whole-program optimization (it was 342 KB with Nuitka 2.6 in August). It ran correctly in 0.20 s, but it also left a .pyi stub containing the secret — build with --no-pyi-file. Nuitka shines at compiling an entire application to a standalone binary (see Nuitka vs PyArmor and Cython vs Nuitka). Best for: shipping a compiled whole app. Trade-off: same as Cython — C toolchain, per-platform builds, and strings still leak.
What changed since my August 2026 test
| Tool | August 2026 (Python 3.11) | October 2026 (Python 3.14) |
|---|---|---|
| Pyobfuscate | ~25 KB, secret hidden | ~62 KB, secret hidden (more layers: encrypted + tamper-locked) |
| PyArmor | 8.5.1: 4.8 KB + 631 KB runtime | 9.2.8: 5.4 KB + 628 KB runtime |
| Cython | 3.0.12: 35 KB, leaks | 3.3.0: 42.5 KB, leaks |
| Nuitka | 2.6.7: 342 KB, leaks | 4.3.1: 235 KB, leaks + .pyi stub leak |
The verdict didn't change: compilers hide logic, obfuscators hide strings, and all four tools work on Python 3.14 today.
Which should you use?
- Free, fast, no toolchain → Pyobfuscate. Paste, click, ship runnable Python.
- Commercial licensing / expiry / hardware-lock → PyArmor.
- Protect an algorithm in a few modules → Cython (small native output).
- Compile a whole app to a binary → Nuitka.
- Just need users without Python to run it → PyInstaller — but it's not protection, so obfuscate or compile first.
The strongest real-world stack combines categories: compile the few sensitive modules (removes bytecode) and obfuscate the rest (hides strings + logic). If a compiled module also needs its strings hidden, obfuscate it first and compile it with Nuitka: in my test that worked, while Cython couldn't compile obfuscated code. Tested combinations.
And the honest ceiling on all of it: anything that runs on the user's machine can be analysed given enough effort — see can Python code be decompiled?. These tools raise the cost; server-side logic is the only absolute.
Try the free one from this test
Pyobfuscate hid the secret with no compiler and no cost. Paste your code into the online obfuscator — rename, encrypt strings, flatten control flow — then compile the sensitive modules if you need native protection.
Open the Python ObfuscatorFree tools mentioned here
Related guides
Frequently asked questions
What is the best Python obfuscator or protection tool?
It depends on the goal. For free, fast source hiding with no compiler, Pyobfuscate; for commercial licensing/DRM, PyArmor; for native compilation of sensitive modules, Cython; for compiling a whole app to a binary, Nuitka. In my October 2026 retest on Python 3.14, Pyobfuscate and PyArmor hid a hard-coded secret while Cython and Nuitka left it in plaintext.
Do Cython and Nuitka hide string literals?
No. In my test, a plain byte search found the hard-coded secret in both the Cython and Nuitka native .pyd files, and Nuitka 4 also wrote it into a .pyi stub file (use --no-pyi-file). Compilation removes the bytecode (so decompilers can't recover source) but does not encrypt string literals. Obfuscate the source first, or keep secrets off the client.
Is PyArmor better than Cython for protecting Python?
They do different jobs. PyArmor obfuscates and adds a licensing runtime (and hid the secret in my test), keeping the code as Python that depends on its runtime. Cython compiles to native machine code with no bytecode to decompile but leaves strings in plaintext. For licensing use PyArmor; for compiled logic protection use Cython — or combine obfuscation with compilation.
Which produced the smallest output?
In my October 2026 test on the same 13-line script (Python 3.14): PyArmor's script stub was 5.4 KB (but needs a 628 KB runtime), Cython was a 42.5 KB native .pyd, Pyobfuscate was ~62 KB, and Nuitka was 235 KB. PyInstaller (a packager, tested separately) was a 9.2 MB exe.
Do PyArmor, Nuitka and Cython support Python 3.14?
Yes. In October 2026 I built the same module with PyArmor 9.2.8, Nuitka 4.3.1 and Cython 3.3.0 on Python 3.14.2 (Windows, MSVC 2022) and all three produced working output. Pyobfuscate's engine also runs on 3.14.
Can I combine these tools?
Yes, and it's the strongest approach, but the order and the tool matter. In my October 2026 test, obfuscating a module and then compiling it with Nuitka worked (the key stayed hidden), while Cython couldn't compile obfuscated code (build error, or a crash on import). The reliable setup: compile the few sensitive modules, obfuscate the rest, then package with PyInstaller using --hidden-import for the compiled module.