OWASP Java Encoder

Contextual output encoding for Java 8+ to help prevent XSS. Version 1.6.0 provides a zero-dependency core, String and Writer APIs, and optional javax/Jakarta JSP adapters.

Latest release
1.6.0

About OWASP Java Encoder

OWASP Java Encoder helps Java applications safely render untrusted text in HTML, JavaScript, JSON strings, CSS, XML, and URL components. Choose the method for the destination parser context and encode at the output boundary. The core has no runtime dependencies; optional JSP adapters integrate with javax and Jakarta containers.

Version 1.6.0, released October 18, 2026, is available from Maven Central. It reduces unnecessary JavaScript letter escaping while preserving recognized HTML-token protection across trusted fragments. Encoded bytes and low-level streaming behavior change; review the release notes when upgrading. The security fixes introduced in 1.5.0 remain in effect.

Start with org.owasp.encoder:encoder:1.6.0. For JSP, use one matching adapter: encoder-jsp or encoder-jakarta-jsp, keeping versions aligned. Java 8 or later is required at runtime. The library is licensed under BSD 3-Clause.

Encoding is one part of XSS prevention. It does not sanitize HTML, validate URLs, or replace safe templates and other application controls. See the How to Use and Deploy tabs, current documentation, and XSS Prevention Cheat Sheet.

Contributing and Security

Contributions are welcome through the GitHub repository. Read CONTRIBUTING.md and BUILDING.md, use JDK 17 with the committed Maven wrapper, and run ./mvnw clean verify. The library runtime baseline remains Java 8.

Report ordinary bugs through GitHub Issues. Report suspected vulnerabilities privately through GitHub Security Advisories, not public issues or pull requests. If GitHub reporting is unavailable, email jeremy.long@owasp.org and jim.manico@owasp.org. Include the affected version, method, input, output context, and a minimal reproduction.

Only the latest 1.x release receives security fixes. The current supported version is 1.6.0. The retired encoder-esapi adapter has no supported version.

Project Leaders

Jeremy Long

Project Leader

Jeremy Long co-leads OWASP Java Encoder and coordinates project maintenance, releases, and security response with Jim Manico.

EmailGitHub

Jim Manico

Project Leader

Jim Manico is the founder of Manicode Security, where he trains developers and organizations in secure coding. He is an OWASP Distinguished Lifetime Member, a Java Champion, and the author of Iron-Clad Java. He leads the OWASP AISVS, Cheat Sheet Series, Java HTML Sanitizer, and Java Encoder projects.

EmailLinkedIn

Major Contributors

Recognizing key contributors who have made significant impact on this project.

Jeff Ichnowski

Original Author

Original author of OWASP Java Encoder.

Project Information

Incubator Project
Classification
Code
Language
Java
License
BSD 3-Clause New or Revised License
Latest Version
1.6.0
Contributors
21
GitHub Stars
548
Downloads
424

Requirements

  • Java 8 or later at runtime
OWASP Logo
OWASP is a nonprofit foundation improving software security through open-source projects, global communities, and education. All resources are free and open to everyone.
OWASP, the OWASP logo, and Global AppSec are registered trademarks and AppSec Days, AppSec California, AppSec Cali, SnowFROC, OWASP Boston Application Security Conference, and LASCON are trademarks of the OWASP Foundation, Inc.
© 2026, OWASP Foundation Inc. All rights reserved.