# TXT to EPUB - Turn a Text File into an Ebook with Chapters

> Free online TXT to EPUB converter: chapters are detected to build the table of contents, legacy encodings are repaired, and you can add a cover and author.

- URL: https://qilingtools.com/en/txt-to-epub
- Category: Productivity (https://qilingtools.com/en/office)
- Tags: [Converters](https://qilingtools.com/en/tags/convert), [Documents](https://qilingtools.com/en/tags/document), [Productivity](https://qilingtools.com/en/tags/office)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

A book saved off the web is usually one multi-megabyte text file: no table of contents, no way to find your place, and often an encoding that shows up as garbage. This tool turns it into a proper EPUB — chapter lines become a real table of contents, the encoding is repaired, and title, author and cover are filled in.

## How to use

1. Pick one or more TXT files (several files are joined in order)
2. Fill in the title and author, and choose a cover if you have one
3. Confirm how chapters are detected, then click Convert to EPUB
4. Check the chapter list and the structure self-check, then download

## Features

- Detects Chapter 7, Part IV and Chinese chapter headings automatically
- Auto-detects GBK / Big5 / Shift_JIS so garbled text never reaches the book
- Title, author, language, description and cover in one pass
- Built-in self-check for mimetype, XML, manifest and navigation
- Very long chapters can be split by length so readers stay responsive

## FAQ

### What if chapter detection misses?

Switch to Custom regex and write your own; it is matched line by line and a matching line becomes the chapter title. To split on a row of asterisks, for example, use ^\*+$. You can also pick One chapter per file and split the text yourself.

### Can a sentence mentioning a chapter be mistaken for a heading?

Almost never. A heading line has to be short and the number must be followed by whitespace, punctuation or the end of the line, so a sentence that continues past the number is left alone.

### Will it work on a Kindle?

Yes. Recent Kindle firmware reads EPUB directly, so Send to Kindle is enough; for very old models convert to AZW3 with Calibre.

### How is the encoding repaired?

By scoring bytes: valid UTF-8 is used as-is, otherwise GBK, Big5, Shift_JIS and EUC-KR are scored on how plausible the resulting characters look. If the preview still looks wrong, set the encoding by hand.

### Do Markdown files work?

Yes. Choose Markdown headings and the first two heading levels become chapters; deeper hashes are stripped and the text stays as a paragraph.

## Related tools

- [QiLing Mind](https://qilingtools.com/en/mindmap): QiLing Mind is a free online mind map editor: add nodes with Tab/Enter, drag to restructure, import and export XMind and Markdown, export PNG/SVG/PDF.
- [Password Generator](https://qilingtools.com/en/password): Free online random password generator: choose length, character sets and look-alike exclusions, generate several at once with a strength meter, all locally.
- [QR Code Generator](https://qilingtools.com/en/qrcode): Free online QR code generator: turn URLs, text, Wi-Fi or contact cards into QR codes with custom size, colour and error correction. Crisp PNG or vector SVG.
- [Word Counter](https://qilingtools.com/en/word-count): Free online word counter: live counts of characters with and without spaces, words, CJK characters, lines, paragraphs, sentences, bytes and reading time.
- [Case Converter](https://qilingtools.com/en/case-convert): Free online case and naming converter: get UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE at once.
- [Lorem Ipsum Generator](https://qilingtools.com/en/lorem): Free online Lorem Ipsum generator: classic Latin placeholder text or Chinese filler by paragraph, sentence or word, with one-click copy for mockups.
- [Sort & Dedupe Text](https://qilingtools.com/en/text-sort): Free online text tool: sort lines alphabetically or by length, remove duplicate and empty lines, trim whitespace, optionally ignoring case. Runs locally.
- [Sign & Stamp PDF](https://qilingtools.com/en/pdf/sign): Free online PDF signing tool: drop in a handwritten signature or company stamp, drag it into place on a page preview, adjust size and opacity, then export.
