- Control chapter order with one HTML contents file and correctly sequenced links.
- Switch from depth-first to breadth-first processing when cross-links disrupt chapter order.
- Use conversion debug output to locate the first stage where ordering fails.
- Confirm the Symptom With a Small Safe Test
- Define the Order With a Table of Contents HTML File
- Check Depth-First and Breadth-First Link Following
- Inspect the Generated Table of Contents
- Check Source Files and Operating System Access
- Use Conversion Debug Output and Job Details
- Run a Clean Temporary Test Before Reinstalling
- Quick Fix Checklist
- Frequently Asked Questions
When calibre converts several related HTML files but places the chapters in the wrong order, the problem is usually established before the output e-book reaches your viewer or device. calibre needs a reliable starting document and a clear chain of links that defines how the files belong together. File names such as chapter01.html and chapter02.html may look correctly sorted in a folder, but naming alone does not necessarily control conversion order.
The most common causes are a missing or incomplete table of contents HTML file, links arranged in an unintended sequence, calibre's default depth-first link traversal, or an unsuitable HTML to ZIP input plugin setting. Less often, broken relative links, duplicate navigation links, inaccessible files, cloud-sync interference, or damaged source HTML can affect the result. The steps below isolate those causes without requiring you to reinstall calibre, delete your library, or change unrelated device and server settings.

Start with free Canva bundles
Browse the freebies page to claim ready-to-use Canva bundles, then get 25% off your first premium bundle after you sign up.
Free to claim. Canva-ready. Instant access.
1. Confirm the Symptom With a Small Safe Test
Before changing calibre preferences, confirm that the chapter sequence is genuinely wrong in the converted book. This matters because the reading order, the navigation table of contents, and the order shown by a particular reader can sometimes differ.
1.1 Compare Reading Order and Navigation Order
Open the converted EPUB or other output format in calibre's E-book viewer. Start at the first chapter and use the normal next-page or next-section controls. Record the actual sequence of chapters. Then open the viewer's table of contents and compare its sequence with the text.
You may see one of three patterns:
- The chapter text and generated table of contents are both out of order.
- The text is correctly ordered, but the generated table of contents is wrong.
- The book is correct in calibre's viewer but appears wrong on a separate device or application.
If both the text and table of contents are wrong, concentrate on the source links and HTML to ZIP processing. If only the table of contents is wrong, inspect the conversion's Table of Contents settings. If the book works in calibre's viewer but not elsewhere, test the output in another reader before changing the HTML input.
1.2 Build a Minimal Three-Chapter Sample
Create a temporary folder outside your main calibre library. Add three small files named chapter1.html, chapter2.html, and chapter3.html. Each file should contain an obvious heading and one short paragraph. Then create an entry file named index.html containing links to those chapters in the intended order.
<html>
<head><title>Test Book</title></head>
<body>
<h1>Contents</h1>
<p><a href="chapter1.html">Chapter 1</a></p>
<p><a href="chapter2.html">Chapter 2</a></p>
<p><a href="chapter3.html">Chapter 3</a></p>
</body>
</html>Add only index.html to calibre, convert it to EPUB, and inspect the result. Success means the chapters appear as Chapter 1, Chapter 2, and Chapter 3 in both the reading flow and navigation panel. If this test succeeds, calibre's basic conversion system is working and the fault is within the original project's links or source files. Stop changing global settings until you inspect that project.
2. Define the Order With a Table of Contents HTML File
The most reliable fix for calibre HTML files in wrong order after conversion is to create one controlling HTML document that links to every chapter in the required sequence. calibre's documentation describes this as a table of contents file. It is not enough to select several files in a file manager and assume their displayed order will become the e-book's reading order.
2.1 Create One Clear Entry Document
Your controlling file can be called index.html, contents.html, or another sensible name. Its important feature is an ordered collection of ordinary HTML links to the chapter files.
<html>
<head>
<meta charset="utf-8">
<title>Example Book</title>
</head>
<body>
<h1>Table of Contents</h1>
<ol>
<li><a href="preface.html">Preface</a></li>
<li><a href="chapter-01.html">Chapter 1</a></li>
<li><a href="chapter-02.html">Chapter 2</a></li>
<li><a href="appendix.html">Appendix</a></li>
</ol>
</body>
</html>Keep all links relative to the entry file. If the chapters are in a subfolder, include that path, such as chapters/chapter-01.html. Match capitalization exactly because Linux file systems, and some archive-processing environments, distinguish between Chapter01.html and chapter01.html.
Add the controlling HTML file to calibre rather than independently adding every chapter as if each were a separate book. calibre can then follow the links, gather the connected resources, and assemble the conversion input.
2.2 Understand Why File Names Are Not Enough
Numbered file names are still useful for organization, but they do not replace links. The operating system may sort files alphabetically, by modification time, or according to locale-specific rules. calibre's HTML input processing is concerned with the linked document structure, not merely the folder display.
For example, renaming files to 001.html, 002.html, and 003.html will not fix the book if the entry document links to them as 001.html, 003.html, and 002.html. The link sequence remains authoritative.
Success means one entry file contains valid links to every required chapter in the intended sequence and the converted reading flow matches that sequence. Once it does, stop renaming files or changing conversion options.
3. Check Depth-First and Breadth-First Link Following
calibre follows links in HTML input in depth-first order by default. This behavior is efficient, but it can surprise users whose chapter pages contain cross-links, nested menus, or repeated links to later sections.
3.1 How Depth-First Ordering Changes the Result
Suppose A.html links to B.html, C.html, and D.html. If B.html also links to D.html, depth-first processing can produce this sequence:
A.htmlB.htmlD.htmlC.html
calibre reaches B, follows B's link to D, and processes D before returning to the remaining links in A. This is a traversal issue, not random corruption and not necessarily a general case of calibre not working.
Navigation menus can make the effect more confusing. If every chapter contains links to Home, Next, Previous, and every other chapter, calibre has many possible paths through the same file collection. Duplicate targets may be filtered, but the first path used to reach a document can affect its position.
3.2 Simplify the Link Graph First
Where practical, make the entry document the primary place that links to all chapters. Within chapter files, limit navigation to predictable links such as Previous, Contents, and Next. Remove accidental links that jump forward to later chapters unless readers genuinely need them.
Also check for links hidden in headers, footers, templates, image maps, and copied website navigation. A downloaded or exported website may contain menus that are reasonable online but unsuitable for defining a linear e-book.
3.3 Use the HTML to ZIP Plugin's Breadth-First Option
If the project needs cross-links and depth-first traversal still produces the wrong order, open calibre Preferences, go to Advanced, select Plugins, and locate the HTML to ZIP file-type plugin. Customize that plugin and select its breadth-first link-following option where available.
Breadth-first processing handles the earlier example as A, B, C, D because it processes the direct links from A before following deeper links found inside B. This setting is particularly relevant when the controlling page lists all chapters directly but individual chapters also link elsewhere.
Convert the minimal sample or a copy of the affected book after changing the option. Success means the direct links from the entry document establish the chapter sequence. If the sequence is now correct, stop changing plugin settings. Do not alter metadata, device drivers, email accounts, or Content server options because they do not normally determine the internal spine order created from multi-file HTML input.
4. Inspect the Generated Table of Contents
A converted book can have a correct content sequence but an incorrect navigation table of contents. calibre's conversion pipeline can use an existing source table of contents, detect headings, or generate entries from links. Those mechanisms can produce a navigation list that differs from the source link order.
4.1 Review Conversion Table of Contents Options
In the conversion dialog, open the Table of Contents section. Check whether calibre is using a table of contents already found in the input or forcing an automatically generated one. Also review options that add detected chapters or derive entries from hyperlinks.
If your entry HTML page already provides clean chapter links, begin with simple settings. Avoid combining several automatic detection rules until the basic order works. Chapter-detection expressions that match unexpected headings, such as a heading in a preface or repeated navigation block, can add misleading entries.
After conversion, use calibre's table of contents editing or inspection tools to compare each navigation entry with its target. Success means selecting Chapter 2 opens Chapter 2 and the navigation list follows the same sequence as the book's reading flow.
4.2 Separate Navigation Errors From Spine Errors
If using Next in the viewer moves through the chapters correctly but clicking the table of contents jumps around, do not rebuild the source package immediately. The content spine is probably correct. Regenerate or edit the table of contents instead.
If both navigation and next-page reading are wrong in the same way, return to the controlling HTML file, link graph, and HTML to ZIP plugin. Knowing which structure is broken prevents unrelated troubleshooting.
5. Check Source Files and Operating System Access
Permissions, cloud storage, antivirus software, and malformed source files are less common causes, but they matter when calibre skips a chapter or follows a fallback link because the intended file cannot be read.
5.1 Validate Every Linked File
Open the controlling HTML file in a web browser and click every chapter link. Each link should open the correct local file without a missing-file message. Check the following details:
- The file extension in the link matches the real extension.
- Uppercase and lowercase characters match exactly.
- Relative paths do not point outside the project folder unexpectedly.
- Percent-encoded spaces and special characters resolve correctly.
- Each document has usable HTML structure and a declared character encoding.
- Redirect scripts or web-only navigation are not required to reach chapters.
Broken image links generally do not reorder chapters, but broken chapter links can prevent a file from entering the conversion input at the expected position.
5.2 Work From a Local Temporary Folder
Copy the complete HTML project to a short, local path before testing. Avoid converting directly from a cloud-sync placeholder, network share, removable drive, protected system folder, or folder that another program is actively updating.
On Windows, confirm the files are fully downloaded and not marked as online-only. On macOS, ensure calibre has permission to access the source location if privacy controls restrict it. On Linux, confirm your user account can read the files and traverse every containing directory.
USB mode and reader-device limits are relevant only after a locally opened e-book is correct. Likewise, firewall, email delivery, and Content server settings can affect whether a book is transferred, but they normally cannot rearrange the HTML chapters inside an already generated EPUB. Test the converted file locally before investigating delivery systems.

6. Use Conversion Debug Output and Job Details
If the source links look correct but the result remains wrong, inspect calibre's conversion pipeline rather than guessing. Debug output can show the order in which the input plugin assembled the HTML documents.
6.1 Save Conversion Debug Output
Open the conversion dialog and use its debug option to select an empty folder. Run the conversion again. calibre can save intermediate material from multiple stages of its pipeline, including input, parsed, structure, and processed content.
Start with the input folder. It reflects the HTML assembled by the input plugin and is therefore the most useful stage for this symptom. Examine the generated documents, links, and package structure. If the order is already wrong there, the cause is the entry HTML, traversal behavior, input packaging, or HTML to ZIP plugin configuration. If the input stage is correct but a later stage changes the result, inspect structure detection and table of contents generation.
6.2 Read the Conversion Job Details
Open calibre's Jobs panel after conversion and view the job details. Look for warnings about missing files, failed links, unreadable resources, malformed markup, or documents that were not included. One warning about an inaccessible chapter can explain why a later chapter moved forward.
Advanced users can reproduce the conversion with ebook-convert and use debug pipeline and verbose options. Most users do not need calibre-debug for this issue because conversion debug output and job details usually reveal the relevant file sequence. Use broader debugging only when the graphical conversion fails unexpectedly or a plugin appears to raise an error.
Success means you can identify the first pipeline stage where the order becomes wrong. Once that stage is known, change only the setting or source structure responsible for it.
7. Run a Clean Temporary Test Before Reinstalling
Reinstalling calibre rarely repairs multi-file HTML order because the order normally comes from the project links or a saved input-plugin preference. Deleting the library is even less appropriate and risks unnecessary data loss.
Instead, create a temporary test book with three chapters and one entry file. Use local files, simple relative links, no scripts, no cloud storage, and no third-party plugins. Convert to EPUB first because it is easy to inspect in calibre's viewer and editor.
If the clean test works, gradually reproduce features from the original project:
- Add the original chapter headings.
- Add the original stylesheets and images.
- Add necessary Previous and Next links.
- Add cross-references in small groups.
- Convert after each change.
The first change that disrupts the sequence identifies the likely cause. Stop there and correct that link or navigation pattern. If the clean sample fails too, reset or review the HTML to ZIP plugin's configuration and test again before considering a reinstall.
8. Quick Fix Checklist
- Create one table of contents HTML file linking to every chapter in order.
- Add the controlling HTML file to calibre instead of treating chapters as separate books.
- Do not rely on alphabetical or numbered file names alone.
- Open the entry file in a browser and test every relative link.
- Remove accidental forward links and web-navigation menus from chapter templates.
- Remember that calibre follows HTML links depth first by default.
- Customize the HTML to ZIP plugin and test breadth-first processing when appropriate.
- Compare the actual reading flow with the generated table of contents.
- Use conversion debug output and inspect the input stage first.
- Test from a local temporary folder with three minimal chapters.
- Do not reinstall calibre or delete the library unless clean tests reveal a broader failure.
9. Frequently Asked Questions
9.1 Why Does calibre Ignore My Numbered HTML File Names?
Because multi-file HTML conversion is primarily based on the entry document and the links calibre follows. Numbered names make files easier for people to organize, but the order of links and the traversal method determine how connected files are collected. Put links in the intended sequence inside a controlling table of contents HTML file.
9.2 What Is Depth-First Link Following?
Depth-first following means calibre can enter a linked chapter and process links found there before returning to later links in the original page. As a result, a cross-link from Chapter 1 to Chapter 4 may cause Chapter 4 to be collected before Chapters 2 and 3. Simplifying the links or using breadth-first processing can correct this.
9.3 Should I Enable Breadth-First Processing for Every HTML Book?
No. Use it when the source has a central contents page whose direct links should take priority over deeper cross-links. If a simple entry page already converts correctly, leave the working setting alone. Changing a global plugin preference without testing can affect later HTML imports.
9.4 Why Is the Generated Table of Contents Wrong When the Chapters Read Correctly?
The navigation table of contents may have been created from detected headings, existing metadata, or hyperlinks independently of the content spine. Review the conversion's Table of Contents options or edit the resulting table of contents. Do not alter HTML traversal settings when the reading flow is already correct.
9.5 Can a Device or the Content Server Reorder the Chapters?
Normally, no. If the EPUB is already wrong in calibre's viewer, the problem occurred during input assembly or conversion. If it is correct locally but wrong on one device, remove the old copy from that device, resend the corrected file, and test another reader. Cached or duplicate editions can make it appear that a fix failed.
9.6 When Should I Stop Troubleshooting?
Stop when the chapters follow the desired sequence in calibre's viewer, the generated table of contents points to the correct locations, and the same file behaves correctly in the intended reading application or device. Once those checks pass, there is no benefit in changing metadata, reinstalling calibre, resetting the library, or modifying unrelated server and delivery settings.