Free developer tool

CSS Print Stylesheet Generator

Toggle common print-CSS rules and watch a clean @media print stylesheet build itself live. Copy it straight into your project.

Generated @media print CSS

Print-ready CSS without guesswork

Assemble a tidy print stylesheet from proven, reusable rules instead of writing @media print from scratch every time.

Toggle what you need

Turn each print rule on or off and see the code block update instantly.

Editable details

Rename the hide-class, tune the page margin and set a base print font size.

Copy and ship

Grab the finished @media print block with one click, ready to paste into your CSS file.

How to use the print stylesheet generator

  1. Toggle the rules you needEnable hiding navigation, forcing black-on-white text, expanding links and more.
  2. Fine-tune the detailsRename the hide-class, adjust the @page margin, or set a base print font size.
  3. Copy the CSSSelect Copy CSS and paste the finished @media print block into your stylesheet.

About print stylesheets

Most websites are designed exclusively for screens, so printing a typical page wastes ink on navigation bars, ads, buttons and background colors that add nothing on paper. The CSS @media print at-rule lets you write styles that only apply when a page is sent to a printer or exported as a PDF via the browser's print dialog, without touching how the page looks on screen at all. A good print stylesheet typically strips away anything interactive or purely decorative, forces high-contrast black text on a white background to save ink and maximize legibility, keeps meaningful information like link destinations visible even without color or underlines, and prevents cards, tables or list items from being awkwardly split across a page boundary. This generator wires up all of these proven patterns as simple toggles, so you can produce a solid starting stylesheet in seconds and then hand-tune it further for your specific layout.

The @page rule

@page controls printer-level properties like page margins, independent of the normal document flow.

break-inside: avoid

This property tells the printer not to split a given box across two pages whenever it can be avoided.

Why force colors

Many browsers skip background colors and images by default when printing; forcing black text on white guarantees readable output regardless.

attr(href) content

The CSS content property can pull an element's own attribute value, which is how link URLs get printed after the visible text.

CSS print stylesheet generator FAQ

What is an @media print stylesheet?

It is a set of CSS rules wrapped in an @media print block that only applies when a page is printed or exported to PDF via print, letting you hide navigation, adjust colors and control page breaks for a cleaner printout.

Why hide navigation and buttons when printing?

Interactive elements like navigation menus, buttons and footers are usually meaningless on paper, so hiding them keeps the printed page focused on the actual content.

What does expanding link URLs after text do?

On paper a link's underline and color are invisible cues, so appending the actual href in parentheses after each link's text keeps that information available on the printed page.

Can I rename the class used to hide elements?

Yes. Use the custom selector field to rename the default .no-print class to any class name that matches your project's existing conventions.

Try other code formatting tools

Keep your codebase clean with these free online formatting tools.