BrainCoder
All guides

How to Convert HTML to PDF Online for Free

BrainCoder4 min read

Turn pasted HTML into a paginated A4 PDF with real, selectable text — what the converter keeps, what it drops, and how to write markup that converts cleanly.

What kind of HTML to PDF this is

There are two ways to turn a web page into a PDF. The first renders the page and captures it, which reproduces CSS but leaves you with a picture of text. The second reads the markup and writes the text into the PDF itself. BrainCoder does the second: the output is a text-based, searchable A4 document built with the standard PDF fonts, so it is smaller, accessible to screen readers, and usable for invoices, reports, specs and archived HTML emails.

Because it works on content rather than pixels, the conversion is predictable. Headings, paragraphs, lists, tables, blockquotes, preformatted code and horizontal rules are laid out across A4 pages, and bold, italic and monospace spans keep their emphasis.

What it does not reproduce

Advanced CSS and layout are simplified, not replicated. Colours, custom fonts, borders, background images, floats, grids, flexbox, positioning and inline styling are not carried into the PDF. Script and style blocks, images, embedded media, SVG and form controls are dropped, and the interface tells you how many elements were skipped so nothing disappears silently.

If you genuinely need a pixel-perfect copy of a rendered page, print to PDF from your browser instead — that path uses the browser's own layout engine. This tool is for the other case: taking markup that is already structured as a document and turning it into a clean, selectable PDF.

Converting locally, without a server

Parsing, layout and PDF generation all run in your browser. The HTML is treated as text and is never rendered or executed as a page, so no script in it can run, and your content never leaves your device.

Each conversion accepts up to 200 KB of HTML and produces up to 200 pages. If the page cap is reached, the tool says so and stops rather than silently dropping the rest of your document.

Tips for clean page breaks

Use real heading elements instead of styled paragraphs — the converter sizes them, bolds them and keeps them on the same page as the text that follows, so a heading never sits alone at the foot of a page.

Keep table cells short where you can. Columns are sized from their widest unbreakable content, and long cells wrap inside the column. Cells with inline text-align right are right-aligned, which is handy for amounts.

Expect a document title to become an H1 when your markup has none, and prefer text that fits the standard PDF fonts. Characters outside that set, and stray angle brackets that break nesting, are replaced with a question mark and counted in the report.

Try it free — HTML to PDF

Paste HTML and download a paginated A4 PDF with real, selectable text — headings, lists, tables and all. Runs locally, nothing uploaded.

Open HTML to PDF