The iLoveMD command line tool brings the converters from this site to your terminal. One command turns a file, or a whole folder, into clean Markdown. It runs on your own machine and makes no network calls, so it is safe to use on private documents and inside scripts.
Install
Install with npm
npm install -g iluvmd-cli
Or run it once without installing: npx iluvmd-cli report.pdf. Node.js 22.22.2 or newer is needed (or 24.15 or newer).
Examples
Common commands
# PDF to Markdown: writes report.md next to the file
iluvmd report.pdf
# Print the Markdown in the terminal instead of writing a file
iluvmd report.pdf -o -
# Several files at once (quote a name that has spaces)
iluvmd letter.docx page.html "meeting notes.txt"
# A folder and its subfolders, results in out/
iluvmd docs/ -r -o out/
# Markdown to Word, PDF or a standalone HTML page
iluvmd notes.md --to docx
iluvmd notes.md --to pdf
iluvmd notes.md --to html
# Read standard input, write standard output
cat notes.txt | iluvmd - --from txt
# Replace a result that already exists
iluvmd report.pdf --force
Each result is written next to its source file with the new ending: report.pdf becomes report.md. Run iluvmd --version to check the install, and iluvmd --help to see every option.
Formats
What it converts
| From | To | Command |
|---|---|---|
| Markdown | iluvmd file.pdf | |
| Word (.docx) | Markdown | iluvmd file.docx |
| HTML | Markdown | iluvmd page.html |
| Plain text | Markdown | iluvmd notes.txt |
| Markdown | Word (.docx) | iluvmd notes.md --to docx |
| Markdown | iluvmd notes.md --to pdf | |
| Markdown | HTML | iluvmd notes.md --to html |
| Markdown | Plain text | iluvmd notes.md --to txt |
Each conversion uses the same code as the matching tool on this site: PDF to Markdown, Word to Markdown, HTML to Markdown, Text to Markdown, Markdown to Word, Markdown to PDF, Markdown to HTML and Markdown to Text.
Why a command line tool
When the terminal is the better place
- Many files. Convert a folder of reports, contracts or saved web pages in one command.
- Documents for AI models. Markdown is compact and keeps headings, lists and tables, which makes it a good format to hand to a language model. Convert first, then pass the Markdown along.
- Scripts and pipelines. Use it in a shell script, a build step or a scheduled job. It reads standard input and writes standard output.
- Private material. Files that should not be uploaded to a conversion service can be converted where they already are.
Privacy and safety
Built to run on files you did not write
- No network. The tool makes no network calls. Its network access is switched off inside the program before any file is read, so a document cannot cause your data to be sent anywhere.
- Limits on every file. Each conversion runs separately with a memory cap and a time limit. A broken or hostile file fails by itself and the rest continue.
- Careful with your disk. An existing file is never replaced unless you pass
--force, a symbolic link at the output path is never followed, and folder output stays inside the folder you chose. - Safe output. HTML output is sanitized and allows no scripts. Remote images become plain links, so opening the page contacts nobody.
- Clean terminal text. Terminal control sequences and invisible direction characters are removed from text written to standard output.
Automation
For scripts and AI agents
An agent that can run a command can use this tool. It needs no key, no account and no setup beyond the install. What a script or an agent gets:
- Pipes. It reads standard input and writes standard output, so it fits between two other steps.
- Results a program can read.
--jsonprints one result per file, and the exit code says what happened. - No network. The document stays on the machine until your own next step sends the Markdown on, for example to a language model or a retrieval index.
- No surprises on disk. A wrong command writes nothing, and an existing file is never replaced without
--force.
Convert a document and pass the Markdown straight to the next step:
# Markdown on standard output, ready for the next command
iluvmd report.pdf -o -
Add --json to get one result per line, ready to parse:
iluvmd docs/ -r -o out/ --json
{"input":"docs/a.pdf","output":"out/a.md","ok":true}
{"input":"docs/b.docx","output":"out/b.md","ok":true}
Exit codes tell a script what happened: 0 everything converted, 1 a file failed, 2 the command was wrong and nothing was written, 3 the only failures were unsupported formats.
Reference
Options
| Option | Meaning |
|---|---|
--to <fmt> | Target format: md (default), docx, pdf, html, txt |
--from <fmt> | Read the input as this format instead of going by the file name. Needed for standard input |
-o, --output <path> | Output file, or a folder for several files. End the path with / to have the folder created. - writes to standard output |
-r, --recursive | With a folder, include its subfolders |
--force | Replace an output file that already exists |
--json | Print one JSON result per file |
--timeout <s> | Seconds allowed per file (default 60) |
Good to know
Limits
- PDF to Markdown reads the text stored in the PDF. Scanned pages need text recognition, which the PDF to Markdown tool on this site offers.
- Images are not carried into Markdown, Word or PDF output. Their alt text is kept.
- Diagrams written in Mermaid stay as code blocks in Word and PDF output.
- PDF and Word files can be up to 50 MB. Markdown going to HTML or plain text can be about 1 MB, to PDF 2 million characters, and to Word 5 million. A file over its limit is reported as an error, never cut short.
- PDF output uses the Roboto font. Characters it does not contain, such as Chinese, Japanese and Korean text and emoji, are left out of the PDF.
- Text input must be UTF-8.
Open source
MIT licensed, readable, yours to use
The CLI is open source under the MIT license. You can read the code, use it at work, and build it into your own tools. Bug reports and ideas are welcome on GitHub.
Prefer a browser? Every converter is also available, with more formats, on the iLoveMD home page.
Questions
Frequently asked questions
How do I use it, step by step?
You type short commands into a terminal, the text window that comes with every computer. No experience is needed:
- Install Node.js from nodejs.org if you do not have it. This is a one-time step.
- Open a terminal. On a Mac, open the Terminal app. On Windows, open PowerShell.
- Install the tool once. Type
npm install -g iluvmd-cliand press Enter. - Go to the folder that holds your file. The command
cdmeans "change directory". For a file in your Downloads folder, typecd Downloadsand press Enter. - Convert the file. Type
iluvmd, a space, and the file name, for exampleiluvmd report.pdf. If the name has spaces, put it in quotes:iluvmd "My Report.pdf". - Find the result. It is in the same folder, with the ending
.md:report.md. Any text editor opens it.
Next time, start at step 4. The tool stays installed.
Is the iLoveMD CLI free?
Yes. It is free and open source under the MIT license. There is no account, no key and no usage limit.
Does the CLI upload my files?
No. Every conversion runs on your machine. The tool makes no network calls at all: network access is blocked inside the program, so a file cannot be sent anywhere.
How do I convert a PDF to Markdown from the command line?
Install the tool with npm install -g iluvmd-cli, then run iluvmd report.pdf. It writes report.md next to the PDF. Add more file names, or a folder, to convert several at once.
Can it convert a whole folder?
Yes. Give it a folder and it converts every supported file inside. Add -r to include subfolders, and -o to choose where the results go. The folder layout is kept.
Does it work on scanned PDFs?
It reads the text stored in a PDF. A scanned page that is only an image has no text to read, so the output will be empty or very short. The PDF to Markdown tool on iluvmd.com offers text recognition for scanned pages.
What do I need to install?
Node.js 22.22.2 or newer (or 24.15 or newer). The tool installs with npm and has no other requirement. It is tested on macOS, Linux and Windows.
Can AI agents and scripts use it?
Yes. It reads standard input and writes standard output, prints one JSON result per file with --json, and returns clear exit codes. Text sent to the terminal has control characters removed, and an existing file is never replaced unless you pass --force.
Can I use it to prepare documents for an AI model?
Yes. Convert the document to Markdown first, then pass the Markdown to the model or to a retrieval step. Markdown keeps headings, lists and tables as plain text. The conversion itself uses no AI model and no network, so the document stays on your machine until you send the Markdown on.
How is the CLI different from the iluvmd.com website?
Both use the same converters, so the output matches. The website is for one file at a time in a browser. The CLI is for many files, scripts and automated work. The website has more tools, such as spreadsheets, slides and e-books; the CLI covers the most used formats first.