Tutorial11 min read

What Is a Headless Browser?

Short answer

A headless browser is a web browser without a visible window, or in Chrome's words, running "the browser in an unattended environment, without any visible UI" (Chrome for Developers): it loads pages, runs their JavaScript, handles cookies and renders the layout like Chrome or Firefox on your screen, but a program controls it through code instead of a person through a mouse. Compared with the Chrome window you use every day, headless Chrome is the same browser: since Chrome 112 (2023) it "creates, but doesn't display, any platform windows", so what is missing is the window and the person at the keyboard, while a script (Puppeteer, Playwright or Selenium) does the clicking. When a headless scraper needs many IPs, ProxyField residential proxies supply them from $1.95/GB, starting with the Easy Trial: 1 GB for $2.95.

residential IPs
412M+
from, traffic never expires
$1.95/GB
Easy Trial
1 GB for $2.95
On this page 12 sections
  1. What "headless" means
  2. Headless Chrome vs the Chrome window you use every day
  3. How does a headless browser work?
  4. What is headless Chrome used for besides testing?
  5. Headless browser testing
  6. Headless Chrome and the Chrome headless shell
  7. Headless Firefox
  8. Examples of headless browsers and the tools that drive them
  9. Advantages and disadvantages of headless browsers
  10. Do you need a headless browser for scraping?
  11. Headless browsers and proxies
  12. What Is a Headless Browser? FAQ

What is headless Chrome used for besides testing? Developers use it for:

  • scraping JavaScript pages that send an empty HTML shell;
  • PDFs and screenshots: invoices, reports, social preview images;
  • pre-rendering single-page apps for search crawlers and link previews;
  • performance traces that show what makes a page slow;
  • AI browser agents that open sites, click and fill forms;
  • monitoring that a login, checkout or search still works;
  • visual and accessibility checks of production pages on a schedule.

What "headless" means

"Head" here means the graphical user interface: the window, tabs, address bar and buttons. A headless browser has the same engine underneath (the HTML parser, the CSS layout, the JavaScript engine, the network stack) and leaves out only the part you look at. Chrome's documentation puts it as running "the browser in an unattended environment, without any visible UI" (Chrome for Developers: Chrome Headless mode, page last updated 2024-10-21).

"Headless mode" is a switch, not a different product: the same Chrome or Firefox binary runs with a window or without one. "Headful" (or "headed") is the opposite, the normal mode with a window.

Headless Chrome vs the Chrome window you use every day

FeatureHeadless ChromeYour everyday Chrome (headful)
Window, tabs, address barCreated but not displayed; pages render in memoryShown on screen
Who drives itA script or test runner (Puppeteer, Playwright, Selenium)You, with mouse and keyboard
Browser engineThe same Chrome, since Chrome 112Chrome
JavaScript, CSS, cookiesFull supportFull support
ProfileWith Puppeteer or Playwright, a fresh temporary profile per run unless the script sets one (--user-data-dir)Your profile: history, logins, bookmarks
Drawing to a screenNone: frames are rendered in memoryEvery frame is painted on your display
Runs onServers, CI pipelines, containers with no displayDesktops and laptops
Started with--headlessThe Chrome icon
Old headlessA separate binary, chrome-headless-shell, since Chrome 132.0.6793.0; lighter, not identical to ChromeNot applicable

What can still differ. New headless Chrome is the same browser, but some behaviour still depends on the tool and its settings (Playwright: browsers):

  • User agent: headless Chrome reports HeadlessChrome instead of Chrome in its user-agent string unless the script sets another one.
  • Automation flag: under Puppeteer, Playwright or Selenium, navigator.webdriver is true, as the W3C WebDriver standard defines for a browser under remote control.
  • Which headless: Playwright's default Chromium headless is chrome-headless-shell, the old implementation, not the full new headless; the chromium channel opts into new headless (Playwright docs; see the library table below).
  • Window size and fonts: a server with no display has its own default viewport and installed fonts, so screenshots can differ from your laptop.

A headless run is not lighter than an HTTP request: it still downloads scripts, styles and often images and fonts, and holds the page in memory like any browser.

Start headless Chrome on each system:

SystemCommand
Linuxgoogle-chrome --headless
macOSopen -a "Google Chrome" --args --headless
Windowsstart chrome --headless

How does a headless browser work?

  1. A program starts the browser

    With a flag such as --headless (Chrome) or -headless (Firefox), usually through an automation library.

  2. The program sends commands

    Over a control protocol: the Chrome DevTools Protocol, WebDriver (Selenium) or WebDriver BiDi, the newer cross-browser W3C protocol.

  3. The browser does the real work

    It requests the page, runs its scripts, builds the DOM, lays it out and paints it in memory.

  4. The program reads the result

    The rendered HTML, text of elements, network responses, a screenshot or a PDF.

Because the page is fully rendered, a headless browser sees what a visitor sees after the scripts have run, including content that a plain HTTP request never gets, such as lists loaded by JavaScript after the first response.

Easy Trial: 1 GB for $2.95.
Try for the price of 1 GB, no subscription, traffic never expires.

What is headless Chrome used for besides testing?

Testing is the best-known job; these are the others, each with the tool and the call that does it, and what the browser costs you compared with a plain HTTP client.

UseWhat it doesHow (tool and call)Cost vs an HTTP client
Scraping JavaScript pagesReads the finished page of a single-page app that sends an empty HTML shellPlaywright page.goto(url) then page.content(); guide: headless browser scrapingMany times the bytes and CPU per page; use it only when the data is not in the HTML or a JSON request
PDFsInvoices, reports, receipts and page archivesPuppeteer or Playwright page.pdf({path: "page.pdf"}); Chrome --print-to-pdfNo HTTP alternative: layout needs a browser; one full page load per document
ScreenshotsSocial preview images, visual records of production pagespage.screenshot({path: "page.png", fullPage: true}); Chrome --screenshotNo HTTP alternative; one full page load per image
Pre-renderingTurns a single-page app into static HTML for search crawlers and link previewsLoad each route, save page.content() as an HTML fileOne full load per route, usually once per deploy, so the cost is small
Performance tracesRecords network requests, screenshots and timings to find what makes a page slowPuppeteer page.tracing.start({path: "trace.json"}); Playwright context.tracing.start({screenshots: true, snapshots: true}); Lighthouse can run on headless ChromeNeeds a real browser by definition
AI browser agentsLets a model open sites, read them, click and fill forms in multi-step tasksMCP servers that drive a browser, such as Playwright MCP and Chrome DevTools MCP; more in AI and web dataEach step is a full page load and a model call; an API or HTTP request is far cheaper when one exists
MonitoringChecks every few minutes that a login, a checkout or a search still worksA scheduled Playwright or Puppeteer script that fails loudlyA browser every few minutes costs CPU and memory; an HTTP check is enough when the flow has no JavaScript
Visual and accessibility checksScreenshots and accessibility trees of production pages on a schedule, compared with the last good runPlaywright Test await expect(page).toHaveScreenshot() and await expect(page.locator('main')).toMatchAriaSnapshot()Needs a browser: an HTTP client sees neither the layout nor the accessibility tree
Routine tasksDownloads a monthly report or submits a form on your own accountsThe same scripts, run on a timerFine for a few runs a day
Running at scale on serversRuns many of the jobs above without managing browser machinesA hosted browser API: chromium.connect_over_cdp(endpoint) in Playwright or puppeteer.connect({browserWSEndpoint})You pay for browser time on someone else's servers instead of running your own

Scraping with a headless browser follows the same rules as any scraping: respect each site's terms, access controls and the law where you work; see is web scraping legal?.

The terminal versions of the screenshot, DOM and PDF jobs need no library at all:

Shell
google-chrome --headless --screenshot=page.png https://example.com
google-chrome --headless --dump-dom https://example.com > page.html
google-chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com

These flags are in Chrome's Headless command-line reference.

Headless browser testing

Headless testing means running browser tests without a visible window, which is how test suites run on CI servers. The test opens the app, performs the steps a user would and checks the result, exactly as in a headed run; only the display is missing. Teams usually develop and debug tests headed, then run them headless in the pipeline. Playwright Test, Selenium with a test framework and Puppeteer with Jest all support both modes with one setting.

Headless Chrome and the Chrome headless shell

Chrome has run headless since Chrome 59 in 2017, and its headless mode changed in two steps (Chrome for Developers: Chrome Headless mode):

  • Chrome 112 (2023): the new headless mode. Headless Chrome is now the real Chrome browser, with every feature, that "creates, but doesn't display, any platform windows".
  • Chrome 132.0.6793.0: the old headless implementation left the Chrome binary and lives on as a separate program, chrome-headless-shell, downloadable from Chrome for Testing (Chrome blog).

So "chrome headless shell" is the old, lighter headless browser: faster to start and smaller, but not identical to Chrome. New headless is the full browser. Bugs in headless mode are reported at goo.gle/headless-bug.

In the automation libraries (from Puppeteer's docs and Playwright: browsers):

LibrarySettingWhat you get
Puppeteerheadless: true (the default)New headless: the full Chrome
Puppeteerheadless: 'shell'chrome-headless-shell, the old headless
Puppeteerheadless: falseHeadful: a visible window
Playwrightheadless=True (the default)chrome-headless-shell; the chromium channel switches to new headless
Selenium (JavaScript).setChromeOptions(options.addArguments('--headless'))New headless

Playwright installs only the shell with npx playwright install --only-shell (Playwright: browsers).

Headless Firefox

Firefox runs headless with the -headless flag, and Selenium, Playwright and Puppeteer can all launch it that way. Puppeteer has supported stable Firefox since v23.0.0 (2024), over WebDriver BiDi (Puppeteer: supported browsers). Firefox matters when a site behaves differently in Gecko, Firefox's engine, or when your tests must cover more than Chromium.

Shell
firefox -headless --screenshot https://example.com

Examples of headless browsers and the tools that drive them

NameWhat it is
Headless Chrome / ChromiumChrome in headless mode; the most used engine for automation
chrome-headless-shellChrome's old, lighter headless implementation as a separate binary
Headless FirefoxFirefox with -headless
WebKit (through Playwright)Safari's engine, headless, via Playwright's builds
PuppeteerNode.js library that drives Chrome and Firefox over the DevTools Protocol or WebDriver BiDi, headless by default (what Puppeteer is)
PlaywrightLibrary for Node.js, Python, Java and .NET that drives Chromium, Firefox and WebKit (what Playwright is)
SeleniumWebDriver-based automation in many languages (what Selenium is)
Hosted browser APIsHeadless browsers that run on a provider's servers: you connect the same Playwright or Puppeteer script over the network instead of running browsers on your own machines

PhantomJS, a well-known headless browser of the 2010s, is no longer developed; modern headless Chrome and Firefox replaced it. Which one to pick for scraping: best headless browsers.

Advantages and disadvantages of headless browsers

Advantages

  • See pages exactly as a browser renders them, including JavaScript content.
  • Run on servers and in containers with no display.
  • Skip painting to a screen, and run several in parallel on one machine.
  • Make tests and scrapers repeatable and fast to rerun.

Disadvantages

  • Far heavier than HTTP requests: more CPU, memory and bytes per page.
  • Slower per page, because they wait for scripts and rendering.
  • Harder to debug without a window; run headed while you write the script.
  • Websites can tell automated browsers from people by many signals, so a headless browser alone does not stop rate limits or blocks; see browser fingerprinting and scraping.

Do you need a headless browser for scraping?

Only when the data is not in the HTML the server sends. Check the page source (Ctrl+U) or the network tab first: if the data is in the HTML, or in a JSON request the page makes, an HTTP client is faster and uses a fraction of the traffic. Use a headless browser for pages that build their content with JavaScript, need clicks or scrolling, or require a login to your own account.

Headless browsers and proxies

A headless browser takes a proxy at launch, like any browser. With Playwright:

Python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True, proxy={
        "server": "http://gate.proxyfield.io:7000",
        "username": "<login>-country-us-city-new_york", "password": "<password>"})
    page = browser.new_page()
    page.goto("https://api.ipify.org?format=json")
    print(page.inner_text("body"))
    browser.close()

<login>-country-us-city-new_york asks for an exit IP in New York. Region, session and session time go in the same username: -region-<region>, -session-<id> and -ttl-<seconds> (30 to 129,600 seconds, 20 minutes by default), as in <login>-country-us-region-new_york-city-new_york-session-he9f2qga-ttl-600; every part after the login is optional. Setup guides: Playwright, Puppeteer, Selenium.

Browser pages download more bytes than plain requests, so block images, fonts and media you do not need: the traffic on a residential proxy is billed per GB. ProxyField residential proxies cost $2.95/GB for 1 GB and fall to $1.95/GB from 1,000 GB, with a new IP per request or sticky sessions from 30 s to 36 h, and no subscription; traffic never expires, and all purchases are final. Start with residential proxies and the Easy Trial: 1 GB for $2.95.

What Is a Headless Browser? FAQ

Does a headless browser hide my IP address?

ProxyField residential proxies, from $2.95 for 1 GB, change the IP a site sees; headless mode on its own does not. A headless browser sends every request from your machine's own IP, exactly like a normal window. To use another IP, pass a proxy at launch, as in the Playwright example above.

What is a headless browser, and how is it different from the regular Chrome window I use every day?

A headless browser is a real browser, such as Chrome or Firefox, that runs without a visible window and is controlled by code. Since Chrome 112, headless Chrome is the same browser as your everyday Chrome: it creates its windows but does not display them, so the differences are no visible window, a script instead of you at the controls, and, with Puppeteer or Playwright, a fresh profile without your logins. Some details still differ by tool and settings, such as HeadlessChrome in the user agent. It loads pages, runs JavaScript and renders them in memory, so scripts can test, screenshot or scrape pages the way a visitor sees them.

What do developers actually use headless browsers like headless Chrome for, apart from automated testing?

Scraping pages that build their content with JavaScript, generating PDFs (page.pdf()) and screenshots, pre-rendering single-page apps for search crawlers and link previews, and recording performance traces. They also run AI browser agents that navigate and fill forms, uptime checks of logins and checkouts, scheduled visual and accessibility checks of production pages, and routine downloads from your own accounts; each costs far more CPU and traffic per page than a plain HTTP request.

What is headless browsing?

Browsing done by a program instead of a person: a script opens pages in a browser without a window, clicks, types and reads the results. It is how automated tests, scrapers of JavaScript pages and screenshot services work.

What does headless mode mean?

It means the browser runs without its graphical interface: no window, tabs or address bar, while the engine still loads and renders pages. In Chrome you turn it on with the --headless flag, in Firefox with -headless.

How does a headless browser work?

A program starts the browser in headless mode and sends it commands over a protocol such as the Chrome DevTools Protocol, WebDriver or WebDriver BiDi. The browser fetches the page, runs its scripts and builds the DOM in memory, and the program reads the HTML, text, network data or a screenshot.

What is headless Chrome?

Chrome running in headless mode. Since Chrome 112 it is the full Chrome browser without a visible window, and since Chrome 132.0.6793.0 the older, lighter headless implementation ships separately as chrome-headless-shell.

What is headless Firefox?

Firefox started with the -headless flag, so it renders pages without a window. Selenium, Playwright and Puppeteer (from v23.0.0) can all drive it, which helps when you need to test or scrape with Firefox's Gecko engine.

What is headless browser testing?

Running automated browser tests without a visible window, usually on CI servers with no display. The test steps and checks are the same as in a headed run; teams debug headed and run the suite headless.

What are the advantages of headless browsers?

They render JavaScript pages fully, run on servers and in containers with no display, skip painting to a screen and can run in parallel. The trade-off is that they are much heavier per page than plain HTTP requests.

Show 1 more questionShow fewer questions

Is a headless browser faster than a normal browser?

It skips painting to a screen, so it saves that work, but it still downloads and runs the same scripts, styles and images, so measure your own job before counting on a speed-up. It is far slower and heavier than an HTTP request.

Easy Trial: 1 GB for $2.95.

Try for the price of 1 GB, no subscription, traffic never expires.