Epub.js is a JavaScript library for rendering EPUB documents in the browser across multiple devices.
The library solves the problem of displaying standardized ebook files in web environments without requiring dedicated applications or plugins. EPUB files are fundamentally collections of HTML5, CSS, images, and media organized according to a standardized schema that defines book structure through a table of contents, manifest, and separation of content from presentation. Epub.js parses this structure and provides an interface for common ebook functions including rendering, persistence, and pagination. The library supports multiple rendering approaches: a default single-section view, a continuous mode that displays multiple sections and preloads offscreen content for seamless scrolling, and configurable flow modes including paginated and scrolled layouts.
Developers should choose this library when building web-based ebook readers or integrating ebook functionality into existing applications. It suits projects that need to display EPUB3 files without server-side conversion or native app development. The tool handles the complexity of the EPUB standard, including manifest-based caching of entire books, while leaving presentation decisions to the developer through configurable rendering modes. For archived EPUB files, the library requires JSZip as a dependency. Scripted content within EPUB files is sandboxed and disabled by default as a security measure, though it can be enabled for trusted content.
Development activity shows consistent maintenance with regular updates to the codebase. The project maintains comprehensive API documentation both on its dedicated documentation site and within the repository as markdown files. Examples demonstrating different rendering approaches are included in the repository, providing practical reference implementations for common use cases.