Pandoc is a command-line tool for converting from one markup format to another: Markdown, HTML, LaTeX, DOCX, etc.

Table of Contents


pandoc is likely installed on your system, but if it’s not, you can easily install it with your operating system’s package manager.

Basic usage

Pandoc syntax is simple:

pandoc [<options>] <input file>
  • If no input files are specified, pandoc reads from standard input (‘stdin’).
  • Output goes to stdout by default.
  • Format of the input and output files are guessed based on files’ extensions, unless explicitly specified.


  • -o <file>: specify an output file.
  • -f <format>: specify a format for the input file.
  • -t <format>: specify a format for the output file.
  • -s: produce a ‘standalone’ document (e.g.: a valid HTML file with the <head> and <body> tags) instead of a document fragment.

Run pandoc --list-input-formats and pandoc --list-output-formats to print a list of supported formats.


You can do a lot of markup and file conversions with pandoc. Check its man page for more info (man pandoc). These are some examples with Markdown:

Markdown to HTML

pandoc -s -o output.html

HTML to Markdown

pandoc -o index.html

Markdown to manual page

  • Check the result before saving
    pandoc -s -t man | man -l -
  • Save the manpage
    pandoc -s -t man -o mycommand

Markdown file must follow this syntax:

% John Doe
% January 2023


command - my new command


`command [-t <type>] <file>`


My awesome command can do a lot of things.


`-t <type>` : specify a type

Markdown to PDF

pandoc -o output.pdf
  • Pandoc cannot convert from PDF to other format.


Convert between CSV-JSON, TXT-ODT/DOCX, Markdown-EPUB, HTML-PDF and much more, with the same syntax. Check pandoc manual page and the website (

If you have any suggestion, feel free to contact me via social media or email.