TXT to EPUB: check encoding, chapters and navigation
Preview TXT encoding, edit chapter start lines and export EPUB 3. Try a two-chapter sample, then check the table of contents and text in your reading app.
Read the encoding preview first
Choose one TXT file and select UTF-8, GB18030/GBK or Big5 to match its source encoding, then select “Read local preview”. The preview shows only the beginning of the text; a readable excerpt does not confirm that the full file is correct. Check names, punctuation and unusual characters before confirming it. The default UTF-8 option checks decoding strictly; it does not detect the original encoding or repair text already damaged in the source. Pasted text is already Unicode and does not need file decoding. A file or pasted text can be up to 10 MiB; pasted text is measured in UTF-8 bytes.
Check chapter start lines
Put each heading on its own line, then select “Detect and edit chapters”. Detection uses fixed patterns for common Chinese chapter headings, “Chapter 1”, “Part I” and headings beginning with #, ## or ### followed by a space. Compare each chapter’s line number, level and title with the source text. Remove false matches; add missing chapters in the chapter list JSON using line, level and title. Chapter start line numbers must refer to existing lines in the source and be listed in ascending order, without duplicates. Use level 1, 2 or 3. Automatic heading lines can be up to 150 characters; manual chapter titles can be up to 300. Some characters, including many emoji, count as two toward these limits. Detecting again replaces manual edits.
Export and reopen
Enter a book title and choose a language tag, such as en, zh or en-US. The tag describes the book’s language and does not translate it. Add an author and a local PNG or JPEG cover if needed. Book title and author can each be up to 300 characters; the language tag can be up to 35. The cover can be up to 5 MiB and 16,000,000 pixels. Create and download the EPUB 3 book, then open it in your intended reading app. Follow the chapter links, check any cover and confirm that the text is selectable. Paragraph spacing and page breaks may vary with reader settings. Processing stays in your browser; keep the original and download the result before refreshing or closing the tab.
A small two-chapter example
Paste the sample below into TXT: the chapter headings start on lines 1 and 4, counting blank lines too. Compare the detected entries with the original text and check that each opening paragraph belongs to its heading. A contents list or a standalone line of dialogue that matches a heading pattern can create a false chapter start; remove those entries from the chapter list. If no headings are detected, the text becomes one chapter. Nonempty text before the first heading is kept as a separate opening chapter using the book title in navigation. That opening chapter counts toward the 1,000-chapter limit.
Keep the original TXT and a copy of the chapter list JSON for later revisions. Changing the text, selected file or file encoding clears detected chapters, so check the list again after those changes. Added lines can shift chapter starts, and renamed headings can change what detection finds. Regenerate the EPUB only after reviewing the revised boundaries; if size or chapter limits are exceeded, split the source into smaller books.
| Checkpoint | Expected result | If it fails |
|---|---|---|
| Encoding preview (file input) | Names and punctuation are readable in the preview excerpt | Select the source encoding and read the preview again |
| Chapter editor | Two headings at lines 1 and 4 in this sample | Correct the chapter line numbers and levels |
| Reading order | Chapter 1 before Chapter 2 | Recheck source and heading order |
| Navigation | Both links open the correct text | Regenerate after correcting headings |
Chapter 1 — Arrival
Mira arrived before sunrise.
Chapter 2 — Home
The lamps were still on.Before you finish
- Confirm text is selectable in the exported book.
- Test every chapter link, including any preface and the final chapter; check long titles.
- Check paragraph breaks in your intended reading app.
- Keep the original TXT and chapter list JSON for the next revision.
References
- W3C: EPUB 3.3
Background on EPUB publication structure and navigation. Reader layout and supported features vary.