PDF to EPUB Converter / TXT to EPUB Converter
TXT to EPUB Converter
Drop a .txt file and get an EPUB with chapters. Encoding is detected, hard-wrapped lines become real paragraphs, and you can change the chapter pattern.
Choose a file to see the chapters that were found.
Get it on your reader
- USB. Connect the reader, open its storage and copy the .epub file into its books folder.
- Email or app. Many readers have a send-to-device email address or app that accepts EPUB. Use your reader maker’s help page for the address.
- DRM-free only. Small readers and many apps cannot open protected books. This file has no protection added.
- Next.Make it smaller, pull out the text, convert a MOBI, or read the notes for common readers.
How chapters are found
- Choose the .txt file. The page detects the text encoding and lists the chapters it found.
- Check the chapters. If the list is wrong, type a chapter pattern (a regular expression) and the list updates as you type.
- Set title and author. Leave them empty to use a title page at the top of the file, or the first line.
- Convert and download. The EPUB has one file per chapter and a table of contents.
By default a line is a chapter heading when it matches one of these, case-insensitive: “Chapter 12”, “CHAPTER ONE”, “Chapter IV: The Return”, “Part 2”, “Book Three”, “第一章”, “Prologue”, “Epilogue”, “Preface”, “Appendix A”. A short line in capitals with a blank line above and below also counts, in a long text. If a file has no headings and is very long, it is cut into parts so your reader still has something to navigate by.
Writing your own chapter pattern
The pattern box takes a regular expression that is tested against each trimmed line, ignoring case. Some examples:
^==\s*(.+?)\s*==$matches “== Title ==” headings.^#\s+.+$matches Markdown-style “# Title” lines.^\d+\.\s+[A-Z].{0,60}$matches numbered headings such as “3. The harbour”.
The matched line becomes the chapter title. An invalid pattern is reported and ignored.
Paragraphs and line breaks
Many text files are hard-wrapped at about 70 characters, so every line ends in a line break. The converter notices that and joins the lines of each block into one paragraph; a line ending in a hyphen is joined to the next word only when the joined word appears elsewhere in the text. Files that already have one paragraph per line are left alone. A title page of a few short lines at the top becomes the book title and, after “by”, the author.
Encodings
UTF-8 and UTF-16 (with or without a byte order mark) are detected automatically. Other files are read as Windows-1252, the common Western European encoding, or as GBK when the bytes look like Chinese text in that encoding. Other encodings may show wrong characters; open the file in an editor and save it as UTF-8 first.