Convert EPUB to TOML

Drag and drop files here or click to select.
Max file size 100mb.
Uploading progress:

EPUB vs TOML Format Comparison

Aspect EPUB (Source Format) TOML (Target Format)
Format Overview
EPUB
Electronic Publication

Open e-book standard developed by IDPF (now W3C) for digital publications. Based on XHTML, CSS, and XML packaged in a ZIP container. Supports reflowable content, fixed layouts, multimedia, and accessibility features. The dominant open format for e-books worldwide.

E-book Standard Reflowable
TOML
Tom's Obvious Minimal Language

Configuration file format created by Tom Preston-Werner (GitHub co-founder). Designed to be minimal, human-readable, and unambiguous. Maps to hash tables and is easy for humans to read and write. Popular for configuration files in Rust, Hugo, and many modern development tools.

Configuration Structured Data
Technical Specifications
Structure: ZIP archive with XHTML/XML
Encoding: UTF-8 (Unicode)
Format: OEBPS container with manifest
Compression: ZIP compression
Extensions: .epub
Structure: Key-value pairs and tables
Encoding: UTF-8 (Unicode)
Format: INI-like configuration syntax
Compression: None (text file)
Extensions: .toml
Syntax Examples

EPUB contains XHTML content:

<?xml version="1.0"?>
<html xmlns="...">
<head><title>Chapter 1</title></head>
<body>
  <h1>Introduction</h1>
  <p>Content here...</p>
</body>
</html>

TOML uses key-value syntax:

title = "Book Title"
author = "Author Name"

[metadata]
isbn = "978-0-123456-78-9"
language = "en"
published = 2024-01-15

[[chapters]]
number = 1
title = "Introduction"
content = "Content here..."
Content Support
  • Rich text formatting and styles
  • Embedded images (JPEG, PNG, SVG, GIF)
  • CSS styling for layout
  • Table of contents (NCX/Nav)
  • Metadata (title, author, ISBN)
  • Audio and video (EPUB3)
  • JavaScript interactivity (EPUB3)
  • MathML formulas
  • Accessibility features (ARIA)
  • Key-value pairs
  • Tables (hash tables/dictionaries)
  • Arrays and nested arrays
  • Strings, integers, floats, booleans
  • Dates and times (ISO 8601)
  • Comments (#)
  • Inline tables
  • Multiline strings
  • Unambiguous data types
Advantages
  • Industry standard for e-books
  • Reflowable content adapts to screens
  • Rich multimedia support (EPUB3)
  • DRM support for publishers
  • Works on all major e-readers
  • Accessibility compliant
  • Extremely human-readable
  • Unambiguous parsing
  • Strong data typing
  • Easy to write and edit
  • Comment support
  • Version control friendly
  • Wide language support
Disadvantages
  • Complex XML structure
  • Not human-readable directly
  • Requires special software to edit
  • Binary format (ZIP archive)
  • Not suitable for version control
  • Not suitable for large data files
  • Limited to structured data
  • No support for rich text or media
  • Relatively new (less universal)
  • Can be verbose for complex data
Common Uses
  • Digital book distribution
  • E-reader devices (Kobo, Nook)
  • Apple Books publishing
  • Library digital lending
  • Self-publishing platforms
  • Application configuration (Cargo, Hugo)
  • Package metadata (Rust, Python)
  • Build system configs
  • Static site generators
  • Dependency specifications
  • Settings and preferences
Best For
  • E-book distribution
  • Digital publishing
  • Reading on devices
  • Commercial book sales
  • Configuration files
  • Metadata extraction
  • Structured data storage
  • Application settings
Version History
Introduced: 2007 (IDPF)
Current Version: EPUB 3.3 (2023)
Status: Active W3C standard
Evolution: EPUB 2 → EPUB 3 → 3.3
Introduced: 2013 (Tom Preston-Werner)
Current Version: TOML 1.0.0 (2021)
Status: Stable specification
Evolution: v0.1 → v0.5 → v1.0
Software Support
Readers: Calibre, Apple Books, Kobo, Adobe DE
Editors: Sigil, Calibre, Vellum
Converters: Calibre, Pandoc
Other: All major e-readers
Parsers: Rust, Python, JavaScript, Go, Ruby
Tools: Cargo, Hugo, Poetry, Pipenv
Editors: Any text editor, VS Code
Other: GitHub Actions, CI/CD systems

Why Convert EPUB to TOML?

Converting EPUB e-books to TOML format is useful for developers and data analysts who need to extract structured metadata and content from e-books into a configuration-friendly format. While EPUB is designed for reading, TOML provides a minimal, human-readable way to represent structured data that's perfect for configuration files, metadata catalogs, and data processing workflows.

TOML (Tom's Obvious Minimal Language) is increasingly popular in modern development ecosystems, particularly in Rust (Cargo.toml), Python (pyproject.toml), and static site generators like Hugo. By converting EPUB to TOML, you can extract book metadata (title, author, ISBN, publication date) and chapter structure into a format that's easy to parse programmatically while remaining human-readable and editable.

The conversion process extracts EPUB metadata from the package document and optionally organizes chapter information, table of contents structure, and other book attributes into TOML's key-value and table-based format. This is particularly useful for building book catalogs, managing library systems, or integrating e-book data into applications that use TOML for configuration.

TOML's strong typing and unambiguous syntax make it excellent for data interchange. Unlike JSON (which can be hard to edit manually) or YAML (which has complex parsing rules), TOML is designed to be obvious and easy for humans to read and write. Its support for dates, arrays, nested tables, and comments makes it ideal for representing book metadata and structure.

Key Benefits of Converting EPUB to TOML:

  • Metadata Extraction: Extract book title, author, ISBN, and more
  • Human Readable: Easy to read and edit configuration-style format
  • Strong Typing: Unambiguous data types (strings, integers, dates)
  • Version Control: Plain text works well with Git
  • Developer Friendly: Popular in Rust, Python, and modern tools
  • Configuration Format: Perfect for app settings and catalogs
  • Structured Data: Organize book information in tables and arrays

Practical Examples

Example 1: Basic Metadata Extraction

Input EPUB metadata (content.opf):

<metadata>
  <dc:title>Learning Python</dc:title>
  <dc:creator>John Smith</dc:creator>
  <dc:language>en</dc:language>
  <dc:identifier>978-0-123456-78-9</dc:identifier>
  <dc:date>2024-01-15</dc:date>
</metadata>

Output TOML file:

title = "Learning Python"
author = "John Smith"
language = "en"
isbn = "978-0-123456-78-9"
published = 2024-01-15

Example 2: Chapter Structure

Input EPUB table of contents:

1. Introduction
2. Getting Started
3. Advanced Topics

Output TOML with chapter metadata:

[[chapters]]
number = 1
title = "Introduction"
file = "chapter01.xhtml"

[[chapters]]
number = 2
title = "Getting Started"
file = "chapter02.xhtml"

[[chapters]]
number = 3
title = "Advanced Topics"
file = "chapter03.xhtml"

Example 3: Complete Book Metadata

Input EPUB complete metadata:

Title: Web Development Guide
Author: Jane Doe
Publisher: Tech Press
Year: 2024
Pages: 350

Output structured TOML:

[book]
title = "Web Development Guide"
author = "Jane Doe"
publisher = "Tech Press"
year = 2024
pages = 350

[publication]
format = "EPUB"
version = "3.0"
language = "en"

Frequently Asked Questions (FAQ)

Q: What is TOML?

A: TOML (Tom's Obvious Minimal Language) is a configuration file format created by Tom Preston-Werner (GitHub co-founder) in 2013. It's designed to be minimal, human-readable, and unambiguous. TOML maps to hash tables and uses a simple key-value syntax similar to INI files but with strong typing and more features. It's the standard for Rust (Cargo.toml) and Python (pyproject.toml) projects.

Q: What gets extracted when converting EPUB to TOML?

A: The conversion focuses on extracting structured metadata from the EPUB file, including: book title, author(s), ISBN, publication date, language, publisher information, and chapter/table of contents structure. The actual text content is typically not included in TOML since TOML is designed for configuration and metadata, not large text storage.

Q: How does TOML compare to JSON and YAML?

A: TOML is more human-readable than JSON (no trailing commas, comments allowed) and less complex than YAML (no significant whitespace issues). TOML has strong, unambiguous data types, making it less error-prone than YAML. It's designed specifically for configuration files, whereas JSON is for data interchange and YAML tries to do both. For readability and simplicity, many developers prefer TOML.

Q: Can I edit TOML files manually?

A: Absolutely! That's TOML's main advantage - it's designed for humans to read and write. Any text editor works. The syntax is straightforward: key = "value" for strings, key = 123 for numbers, key = true for booleans. Tables use [table_name] headers, and arrays of tables use [[array_name]]. Comments start with #. Many editors have TOML syntax highlighting available.

Q: What programming languages support TOML?

A: TOML has parsers for virtually all major languages: Rust (toml crate), Python (tomli/tomllib), JavaScript/Node.js (toml-js, @iarna/toml), Go (BurntSushi/toml), Ruby (toml-rb), C# (.NET), Java, PHP, and more. Python 3.11+ includes tomllib in the standard library. The TOML website maintains a list of implementations for different languages.

Q: Why would I use TOML for e-book metadata?

A: TOML is excellent for building book catalogs, library management systems, or metadata databases. It's human-readable (easy to review and edit), version-control friendly (track changes to book metadata), strongly typed (dates are dates, numbers are numbers), and widely supported by modern tools. If you're building a book management application in Rust or Python, TOML is a natural choice.

Q: Can TOML store the actual book content?

A: While technically possible using multiline strings, TOML is not designed for large text content storage. It's a configuration format, not a document format. For book content, use formats like Markdown, plain text, or keep the original EPUB. Use TOML for metadata, settings, chapter organization, and structured information about the book.

Q: Is TOML better than XML for metadata?

A: For human readability and editing, yes. TOML is far more readable than XML and easier to write manually. XML is more powerful for complex document structures and has better tooling for validation (XSD schemas). For simple metadata and configuration, most developers prefer TOML. For complex hierarchical data with validation requirements, XML may be better. It depends on your specific use case.