← toolkit.bot

How to Batch Convert Multiple PDFs to EPUB (Free & Fast)

Need to convert a folder full of PDFs? Here are three methods: a shell script using curl, a Python script for more control, and Calibre for simple offline batch jobs. All use the free tier (5/month) or run locally.

Method 1: Shell script with curl (Mac / Linux / WSL)

This converts every PDF in a folder to EPUB using the toolkit.bot API:

#!/bin/bash
# batch_convert.sh — convert all PDFs in current folder to EPUB
for f in *.pdf; do
  echo "Converting: $f"
  curl -sX POST https://toolkit.bot/convert     -F "file=@$f"     -o "${f%.pdf}.epub"
  echo "  → ${f%.pdf}.epub done"
  sleep 2  # be polite to the server
done
echo "All done."

Save as batch_convert.sh, make executable (chmod +x batch_convert.sh), run in the folder with your PDFs. The sleep 2 avoids rate-limiting.

Method 2: Python script (more control)

For error handling, retries, and logging:

import pathlib, requests, time

PDF_DIR = pathlib.Path("./pdfs")
OUT_DIR = pathlib.Path("./epubs")
OUT_DIR.mkdir(exist_ok=True)

for pdf in sorted(PDF_DIR.glob("*.pdf")):
    out = OUT_DIR / pdf.with_suffix(".epub").name
    if out.exists():
        print(f"Skip (already done): {pdf.name}")
        continue
    print(f"Converting: {pdf.name}")
    with open(pdf, "rb") as fh:
        r = requests.post(
            "https://toolkit.bot/convert",
            files={"file": (pdf.name, fh, "application/pdf")},
            timeout=120,
        )
    if r.status_code == 200:
        out.write_bytes(r.content)
        print(f"  → {out.name}")
    else:
        print(f"  ✗ Error {r.status_code}: {r.text[:200]}")
    time.sleep(2)

print("Done.")

Install requests first: pip install requests. The script skips already-converted files, so you can run it safely multiple times. See the full Python API guide → for async and parallel variants.

Method 3: Calibre (offline, no API limit)

Calibre's command-line tool ebook-convert can batch convert locally — useful if you're offline or processing hundreds of files:

for f in *.pdf; do
  ebook-convert "$f" "${f%.pdf}.epub"
done

Calibre works well for simple single-column books. It struggles with scanned PDFs (no OCR), two-column academic papers, and complex tables. Calibre vs toolkit.bot comparison →

Windows batch script

@echo off
for %%f in (*.pdf) do (
  echo Converting %%f
  curl -sX POST https://toolkit.bot/convert ^
    -F "file=@%%f" ^
    -o "%%~nf.epub"
  echo   done
  timeout /t 2 /nobreak > nul
)
echo All done.

Save as batch_convert.bat and run in a folder with your PDFs. curl ships with Windows 10 and later — no extra install needed. Full Windows guide →

Rate limits and large collections

The free tier allows 5 conversions per month. For larger collections, space out requests (the sleep 2 in the scripts above helps), or upgrade to a paid plan for higher limits. The API returns a 429 status when you hit the rate limit — the Python script above logs this clearly.

Start converting — free, no account required.

Convert PDF to EPUB →

Related guides