Documentation

JavaScript Obfuscator docs

Reference guides for command-line usage, protection options, cross-file workflows, and the desktop app.

Inside The Docs

Practical guides, not placeholder pages.

How-to guides Start with command-line usage, then move into feature-specific references.
Advanced protection Browse cross-file obfuscation topics like Replace Globals and Protect Members.

Replace Globals

  • RenameGlobals
  • Corporate

Replace Globals renames global functions and variables across every file in the same project, so shared references stay consistent after obfuscation.

Why it exists

Standard name mangling is intentionally conservative about global identifiers, because renaming a global in one file can break another file that still references the old name. Replace Globals solves that by using one shared mapping across the project.

That is why this feature belongs in the cross-file group: it only works properly when the related scripts are protected together in the same JavaScript Obfuscator project.

Replace Globals overview

Basic cross-file example

a.js
b.js
=>
a.js
b.js

In this example, the global function is renamed once and every file in the project uses the same generated name.

Rename by rules

If you want to rename only selected globals, define a regular expression in Rename by rules. A pattern such as ^__ limits renaming to identifiers that start with a double underscore.

Rename by rules option Custom identities option Rename by rules example

Example source:

function __internalGetSetting() {}
function __loadConfig() {}
function ShowLastError() {}

With ^__, only the private globals are renamed while ShowLastError keeps its public name.

=>

Custom identities

Custom Identities lets you control specific mappings directly. For example:

checkValue:?
localData:?

This tells the obfuscator to rename checkValue and localData to generated names while leaving unrelated globals untouched.

Custom identities mapping
=>

For debugging or deterministic builds, you can assign fixed names instead:

checkValue:d01
localData:l01
=>

Stored mappings

JavaScript Obfuscator stores mapping information with the project so the same identifiers can keep the same replacement names across later runs. After obfuscation, you can inspect the last generated mapping to review or extend it.

Last generated mapping
Recommendation: treat unmatched identifiers as public. Only rename globals that are private to your project, and keep every dependent file in the same JavaScript Obfuscator project when you enable this feature.