LinuxCommandLibrary

ebook-convert

Convert ebook formats

TLDR

Convert an e-book into another format

$ ebook-convert [path/to/input_file] [output_file]
copy

Convert Markdown or HTML to e-book with TOC, title, and author
$ ebook-convert [path/to/input_file] [output_file] --level1-toc="//h:h1" --level2-toc="//h:h2" --level3-toc="//h:h3" --title=[title] --authors=[author]
copy

SYNOPSIS

ebook-convert input_file output_file [output_format] [--options...]
Example: ebook-convert book.epub book.mobi --authors 'Author Name'

PARAMETERS

--help, -h
    Show help message and exit

--version
    Display program version

--list-formats
    List all supported input/output formats

--username
    Username for DRM-protected input files

--password
    Password for DRM-protected input files

--input-encoding
    Character encoding of input file

--authors
    Comma-separated list of authors

--author-sort
    Author sort names

--title
    Set output title

--cover, -c
    Path to cover image file

--no-default-cover
    Omit auto-generated default cover

--tags
    Comma-separated list of tags

--series
    Series name

--series-index
    Series number

--publisher
    Publisher

--pubdate
    Publication date (YYYY-MM-DD)

--comments
    Comments

--languages
    Comma-separated list of languages

--isbn
    ISBN

--output-profile
    Device profile (e.g., kindle, kobo)

--embed-all-fonts
    Embed all input fonts

--embed-font
    Embed specific font families

--base-font-size
    Base font size in pts

--margin-bottom
    Bottom margin (in pts)

--margin-top
    Top margin (in pts)

--margin-left
    Left margin (in pts)

--margin-right
    Right margin (in pts)

--personal-doc
    Optimize for personal document workflow

--no-chapters-in-toc
    Disable chapters in TOC

--pretty-print
    Pretty-print output HTML

DESCRIPTION

ebook-convert is a versatile command-line tool from the Calibre ebook library management suite. It enables conversion of ebooks from numerous input formats (e.g., EPUB, MOBI, AZW3, PDF, FB2, CBZ, DOCX) to various output formats, preserving metadata, images, fonts, and structure where possible. Users specify an input file, desired output file (with extension implying format), and options for customization.

Key strengths include metadata editing (--title, --authors), cover management (--cover), font embedding (--embed-font), page layout control (--margin-top), and device-specific profiles (--output-profile kindle). It's script-friendly for batch jobs, supports DRM handling with credentials, and optimizes for e-readers. Conversions handle HTML/CSS cleanup, table of contents generation, and heuristics for better reflow.

Ideal for Linux servers, automation, or headless environments. Requires Calibre installation. While powerful, quality varies by input complexity and formats—semantic formats like EPUB convert best, raster like PDF less so. Run ebook-convert --help for full options, as they expand per output format.

CAVEATS

Not all conversions are lossless (e.g., images or complex layouts may degrade); DRM support limited to DeDRM plugins; high CPU/RAM use for large books; format-specific options not listed—use --help; requires Calibre installed.

INSTALLATION

On Debian/Ubuntu: sudo apt install calibre. Download from calibre-ebook.com for other distros.
Fedora: sudo dnf install calibre.

EXAMPLES

ebook-convert input.pdf output.epub --pdf-page-numbers --authors 'John Doe'
ebook-convert *.mobi output.kfx --output-profile kindle-paperwhite

FULL OPTIONS

Run ebook-convert --help for complete list (100+ options, varies by output format like --dont-split-on-page-breaks for AZW3).

HISTORY

Developed by Kovid Goyal as part of Calibre (initial release 2006). ebook-convert introduced early for batch conversion needs; evolved with 20+ years of updates adding format support (e.g., newer EPUB3, WEBP images) and quality heuristics. Widely used in Linux ebook workflows.

SEE ALSO

calibredb(1), ebook-meta(1), ebook-edit(1), calibre(1)

Copied to clipboard