October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
browser automation

How to Set the Minimum Font Size in Puppeteer or Chromium

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Puppeteer has no documented minimumFontSize launch option. For a per-page browser default, use the experimental Chrome DevTools Protocol method Page.setFontSizes to set standard and fixed font sizes. It does not guarantee a minimum for every font size explicitly declared by a page’s CSS. If you need a strict rule for selected content, apply and test a CSS or DOM policy instead.

Choose the control that matches what you mean by “minimum”

These approaches act at different scopes, so they are not interchangeable. A browser default is useful when you want to change what the page inherits; a page policy is appropriate when you own the content and must enforce a floor on selected elements. Chrome’s profile-level minimum-font-size setting is a separate extension API, not a Puppeteer launch option.

Approach Scope What it controls Trade-off
Page.setFontSizes CDP-controlled page or session Default standard and fixed sizes Experimental; not a universal clamp over author CSS. CDP method reference
CSS or DOM policy Selected elements on a page you control The rules you define and apply You must choose the scope and test layout effects.
chrome.fontSettings.setMinimumFontSize Chrome profile, through an extension The user-facing profile minimum-font-size setting Requires an extension in the test fixture; it is not a Puppeteer launch property. Chrome fontSettings API

Set standard and fixed defaults through CDP

Puppeteer can create a Chrome DevTools Protocol (CDP) session for a page and send Page.setFontSizes. The protocol describes the method as setting default font sizes. Its optional integer properties are standard and fixed; leaving one out leaves that property unchanged. The example uses 18 for both, but that is a chosen test value, not a universal recommendation.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  const client = await page.createCDPSession();

  await client.send('Page.setFontSizes', {
    fontSizes: {
      standard: 18,
      fixed: 18
    }
  });

  await page.goto('https://example.com', {
    waitUntil: 'domcontentloaded'
  });

  console.log('Page loaded with CDP default font sizes set.');
} finally {
  await browser.close();
}

Run with a Node.js version that supports ES modules and an installed Puppeteer package. Save it as an .mjs file and run node filename.mjs. If your project uses CommonJS, convert the import to the equivalent require form for your setup. The browser is closed in finally so it is also cleaned up if navigation or the CDP command fails.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

Apply the setting before navigation

The example sends the command before goto, so the defaults are in place for the initial page load. If the test navigates to another page, creates another page or attaches to a different target, make sure you set the values on the relevant page’s CDP session too. A CDP session is associated with the page it was created from; do not assume a command sent to one page configures every page in the browser.

Set only one default when that is all you need

Because the protocol properties are optional, you can send only the setting under test. For example, to change the standard default without specifying a fixed size:

await client.send('Page.setFontSizes', {
  fontSizes: { standard: 18 }
});

Use integer values for the protocol properties. Keep the value explicit in the test so that a failure can be reproduced and understood.

Why this is not a hard minimum for all page text

Page.setFontSizes changes browser defaults. It should not be treated as a documented clamp on every explicit CSS declaration. A page can specify its own font sizes, and the protocol method is not documented as overriding every author rule. If a test needs to prove that no selected text renders below a threshold, inspect or modify the page’s CSS/DOM policy and assert the resulting styles or rendered behavior for the elements in scope.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a page you control, define which elements count before writing the policy. For example, decide whether the rule covers body copy only or also navigation, labels, buttons, code, captions and text inside embedded components. A broad rule can disrupt compact controls or cause wrapping, overflow and overlap; a narrower rule requires a maintained selector set. Check the resulting layout at the viewports and states your application supports.

Do not call a CSS policy a browser preference: it is page-level enforcement under your control, and its behavior depends on the selectors and styles you apply. Conversely, do not use a changed browser default as proof that every explicitly styled element meets a minimum.

Launch the intended Chromium build

Reproducibility depends on which browser Puppeteer launches. The Puppeteer configuration guide documents executablePath for selecting a browser binary and describes configuration through files or environment variables. With the bundled browser, the path can be omitted; if you manage Chrome separately, select the intended binary deliberately.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({
  executablePath: process.env.CHROME_PATH // optional with the bundled browser
});

puppeteer downloads a supported Chrome build, while puppeteer-core does not download Chrome and requires you to manage and select a browser executable or channel. See the Puppeteer installation guide. Record the Chromium revision used by a test that depends on CDP behavior, and re-check it when upgrading Puppeteer or Chromium.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not rely on an unverified command-line switch

Puppeteer’s LaunchOptions.args accepts extra command-line arguments for the browser instance; the LaunchOptions reference describes it as additional command-line arguments. That makes args a way to pass a switch, not evidence that a particular switch exists or implements the setting you want.

The Chromium guidance on command-line switches notes that Chrome and Chromium accept switches, and warns that some are temporary and can change or be removed. The official switch guidance does not establish a stable minimum-font-size switch for this purpose. Avoid copying an alleged font-size flag from an unrelated example unless you have verified it against the exact Chromium build you run.

When the Chrome profile preference is the actual test target

If you need to test Chrome’s own user-facing minimum-font-size preference, the closest documented control is the extension API chrome.fontSettings.setMinimumFontSize. It is part of the Chrome extension API, not a Puppeteer launch option. That distinction matters: a test of the extension preference should include the extension and profile setup as part of its fixture, rather than silently substituting a CDP default-size command.

Troubleshoot common failures

  • minimumFontSize is rejected or has no effect in launch options: Puppeteer does not document it as a launch property. Use the CDP method for default standard/fixed sizes, or a separate page policy or extension fixture according to the required scope.
  • Page.setFontSizes reports an unknown method: Check the browser binary and Chromium revision actually launched. The method is experimental, so protocol support can differ across revisions; update or select a compatible build, then record that revision in the test.
  • The call succeeds but some text remains smaller: The command sets defaults; it is not a guaranteed clamp on explicit CSS. Identify the affected elements and test an explicit CSS/DOM policy if they must meet a hard floor.
  • The result changes after an upgrade: CDP marks this method experimental. Pin or record the browser version for reproducibility and verify the behavior again when changing Puppeteer or Chromium.
  • puppeteer-core cannot find Chrome: It does not download a browser. Set executablePath to the managed binary or configure the intended channel.
  • The value appears to apply to one page but not another: Create a CDP session for the page under test and send the command there. Do not assume a session for one page configures the entire browser.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a page rather than test Chromium’s font-setting behavior, ScreenshotNeo can return a screenshot or PDF through one GET request. This does not replace a Puppeteer test of font defaults or a strict CSS minimum; it is a simpler capture path. The API supports custom CSS, so you can supply a page-level rule when that suits your capture, but define and verify its scope for your page.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value

For API details and options, see the ScreenshotNeo documentation. Example using cURL:

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com 
  -o shot.webp
  • Cookie/consent banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; each cleanup step can be turned off.
  • Bot checks/CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing; response headers identify the page verdict and whether the request was billed.
  • An MCP server provides take_screenshot, get_page_info and capture_pdf for AI agents and other MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Practical test checklist

  • Decide whether you are testing browser defaults, a Chrome profile preference or a hard page-level rule.
  • Record the Puppeteer package and Chromium revision, especially when using the experimental CDP method.
  • Set CDP defaults on the page’s session before navigation when you want them in place at initial load.
  • Include explicitly styled text and layout-sensitive elements in assertions if the requirement applies to them.
  • Re-run the test after browser upgrades and inspect layout changes, not just whether the CDP command returned successfully.

Frequently Asked Questions

Can I use `Page.setFontSizes` to test a site’s accessible text-resizing control?

Not by itself. The method changes browser defaults; exercise the site’s own control separately and assert its resulting page behavior.

Does Puppeteer expose a documented `minimumFontSize` launch option?

No. Use the control that matches the required scope rather than adding an undocumented launch property.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Are `standard` and `fixed` separate settings?

Yes. They are separate optional integer properties in the CDP method, and an omitted property remains unchanged.

Quick Recap

Bestseller No. 1
The Chromium Connection: A Lesson in Nutrition
The Chromium Connection: A Lesson in Nutrition
Used Book in Good Condition
$215.30
Bestseller No. 3
Bestseller No. 4
Bestseller No. 5
The Chromium Diet, Supplement and Exercise Strategy
The Chromium Diet, Supplement and Exercise Strategy
Used Book in Good Condition
$17.95

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.