yWorks Logo

yGuard - Java™ Bytecode Obfuscator and Shrinker

yGuard is a free Java bytecode obfuscator and shrinker that improves your software deployment by prohibiting unwanted access to your source code and drastically shrinking the processed Jar files at the same time.

The current yGuard version is 2.5.3.

Please refer to the requirements and changelog for details about the latest version.



yFiles for Java yEd Editor
  • yGuard is absolutely free! Contrary to expensive commercial products of our competitors providing the same amount of features as yGuard or less, yGuard is free.
  • yGuard is an Ant task! Existing tools use proprietary mechanisms to invoke or configure the task of obfuscation. As an Ant task, yGuard can be seamlessly integrated into your deployment process using XML syntax.
  • yGuard provides highly configurable name obfuscation that will protect your intellectual property from reverse engineering.
  • yGuard provides elaborate code shrinking functionality through dependency analysis.
  • yGuard 2.0 offers a new powerful and easy to use XML syntax that allows the effortless definition of code entities e.g. based on pattern sets or inheritance.
  • yGuard will correctly obfuscate and shrink programs that depend on external libraries.
  • yGuard can automatically rename and adjust textual resource files according to the obfuscation scheme.
  • yGuard can scramble and unscramble or shrink line number table information. This means that debugging an obfuscated program is still achievable without weakening the obfuscation.
  • yGuard can create patches! During each obfuscation run, yGuard produces XML output that can be used to create subsequent patches of already deployed obfuscated applications.
  • yGuard supports JDK 1.5 features and correctly obfuscates classes compiled with its new features.

Why Use yGuard?

  • Name Obfuscation: protects your .class files from reverse engineering by replacing package, class, method, and field names with inexpressive characters. If afterwards the obfuscated .class files are decomplied, it will be extremely diffcult to derive the original purpose of the obfuscated code entities.
    As an additional side-effect, name obfuscation will significantly reduce the size of your application, depending on the chosen mapping scheme.
  • Code Shrinking: drastically reduces the size of the input Jar files if your application does not use all of the contained bytecode.
    The shrinking engine analyzes the bytecode of all input Jar files in order to determine which code entities can not be reached from a set of given code entry points. These obsolete code fragments (either entire classes or single methods and fields) will then be removed by yGuard. If you use any third party libraries, you will probably benefit a lot from the yGuard shrinking engine, since applications usually do not use all of the functionality provided by an external library and a large fraction of the contained bytecode and resources can be safely removed.


The yGuard Manual is a detailed user guide which will enable you to use yGuard as an ordinary Ant task. The Change Log describes bugfixes and improvements added to new yGuard releases.


To run the yGuard software, you need JDK 1.4.x or greater and Ant 1.5.x or greater (it might be compatible with earlier versions of either software, this has not been tested, however).

Java 7 / Java 8 Compatibility

Beginning with version 2.5, yGuard supports obfuscation of Java class files that contain the invokedynamic instruction, which was introduced with the Java 7 .class file format.
JDK 7 does not contain any means of issuing this instruction, with JDK 8 it is being issued when using lambda expressions or default methods.

While yGuard does fully support obfuscating invokedynamic instructions and therefore default methods and lambda expressions, shrinking of Java class files that contain the invokedynamic instruction is not supported yet.

Download Section

yGuard 2.5.3
download page
This Zip file contains the Jar including the Ant yguard task and the library in compiled form. In addition, there is a detailed documentation regarding how to use the Ant task, as well as the license. See the documentation for example usages and documentation of yGuard.
yGuardLib 2.5.3
Library Sources
download page
This file contains the source code of the yGuard library. The library is based on the Retroguard Obfuscator (version 1.0) by Retrologic. Retroguard is distributed under the Lesser GNU Public License (LGPL), which is contained in the Zip file. It should be noted that this version is a library only and therefore it does not contain any directly executable code. Furthermore, the sources of the Ant task are not included in this distribution. Use the above Jar to obtain a fully functional Jar containing the task. If required, you can modify the library according to the LGPL and use your modified version with the yGuard distribution from the above link.