jsoup is a Java HTML parser built for parsing, extracting, manipulating, and cleaning HTML and XML documents.
The tool addresses the challenge of working with real-world HTML that ranges from perfectly valid to malformed tag-soup. It implements the WHATWG HTML5 specification and parses documents to the same DOM structure that modern browsers produce, ensuring consistent behavior across different HTML inputs. Users can fetch HTML from URLs, files, or strings, then extract data using DOM traversal, CSS selectors, or XPath expressions. The library also provides HTML manipulation capabilities and includes a safelist-based sanitizer to clean user-submitted content and prevent XSS attacks.
Developers should choose jsoup for server-side Java applications that need robust HTML parsing and web scraping. It suits projects ranging from simple data extraction tasks to complex HTML manipulation and content sanitization workflows. The library handles malformed HTML gracefully, making it reliable for scraping real-world websites where HTML quality varies. For Android projects, core library desugaring with NIO specification support must be enabled to use Java 8+ features.
Development is maintained by a primary author with contributions from multiple developers over time. The project maintains a stable release status and provides community support through GitHub Discussions for usage questions and feature ideas. Bug reports are tracked through a dedicated issue system with duplicate checking encouraged.