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

html2canvas is usually not taking a pixel screenshot. It walks the DOM, reads the CSS it supports, and reconstructs a canvas. If two clicks produce different images, some input to that reconstruction changed: page state, viewport, scroll position, device-pixel ratio, resource readiness, animation, cross-origin access, canvas dimensions, or unsupported CSS. Make those inputs explicit and capture a stable clone of the page.

What html2canvas is—and why that matters

The html2canvas documentation describes a script that “traverses through the DOM of the page it is loaded on.” It does not copy the browser’s already-painted pixels. It creates its own representation from element information and implemented CSS properties. Consequently, a visually identical page can still produce different output if the DOM, computed styles, viewport, scroll offsets, loaded resources, or timing differ between calls.

This distinction also sets a limit: changing a delay or option cannot make an unsupported CSS property render correctly. Every CSS property has to be implemented by html2canvas, and the project’s FAQ says complete CSS support is not possible.

First, make the capture inputs repeatable

Hold the application state constant

Capture the same route, selected tab, expanded rows, authentication state, data response, and target element each time. A framework may still be rendering after the click that starts your capture. Wait for the application’s own “ready” signal and for the assets relevant to the target. document.fonts.ready waits for fonts, not for every image or network request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty

Fix the viewport and pixel scale

By default, scale follows window.devicePixelRatio. Two devices, monitors, browser zoom levels, or remote sessions can therefore produce different pixel dimensions. Set it explicitly when byte-for-byte or dimension-for-dimension consistency matters. Set windowWidth and windowHeight to keep media-query decisions stable.

Fix scroll coordinates

Sticky and fixed elements are positioned relative to the viewport. A different scroll position changes their appearance and can alter what html2canvas reconstructs. Set scrollX and scrollY deliberately, especially when capturing an element from a scrolled page.

Remove transient behavior in the cloned document

Use onclone to change only the document used for rendering. You can disable animations and transitions, hide blinking cursors, close menus, or remove a timestamp without disturbing the live interface.

A minimal stabilization pattern

await document.fonts?.ready;

const element = document.querySelector('#capture');
if (!element) throw new Error('Missing #capture');

const canvas = await html2canvas(element, {
  scale: 1,
  windowWidth: 1280,
  windowHeight: 800,
  scrollX: 0,
  scrollY: 0,
  onclone: (clonedDocument) => {
    clonedDocument.querySelectorAll('.animated, .transient').forEach((node) => {
      node.style.animation = 'none';
      node.style.transition = 'none';
    });
  },
  onError: (error) => console.error('Capture resource error:', error)
});

document.body.appendChild(canvas);

This is a stabilization pattern, not a guarantee that every application is ready. Replace the selectors and viewport with values appropriate to your page, and wait for asynchronous data and images using signals supplied by your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
SANDISK 128GB Ultra Flair, USB-A Flash Drive, Up to 150MB/s Read Speeds
  • High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
  • Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
  • Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
  • Sleek, durable metal casing
  • Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]

Diagnose differences before comparing pixels

  1. Use one target. Pass the same element reference or selector and log its scrollWidth, scrollHeight, getBoundingClientRect(), and computed display state.
  2. Log the rendering context. Record window.innerWidth, window.innerHeight, devicePixelRatio, scrollX, scrollY, and the html2canvas options for each click.
  3. Check readiness. Confirm that application data, fonts, and images have completed before invoking html2canvas. A loading spinner or late layout shift is enough to change the reconstruction.
  4. Freeze motion. Apply the onclone changes above. If the output becomes stable, the cause is mutable animation or transient UI state.
  5. Keep diagnostics enabled. Do not disable logging while investigating. Use onError to record resource failures and inspect the browser console and network panel.

Why aren’t my images rendered?

Images hosted on another origin are subject to the browser’s content-security rules. Set useCORS: true only when the image server sends an appropriate Access-Control-Allow-Origin response. That option requests a CORS load; it cannot grant permission that the server did not provide. If you control neither server, use a documented proxy route or serve the asset from an allowed origin.

const canvas = await html2canvas(element, {
  useCORS: true,
  logging: true,
  onError: (error) => console.error(error)
});

Check the image request itself in developer tools. A redirect to a host without CORS headers, an authentication failure, or a blocked mixed-content request can look like an html2canvas rendering defect.

Why is the produced canvas empty or cut off halfway through?

Canvas dimensions are limited by the browser, operating system, graphics hardware, and available memory. The FAQ’s dimension and area figures are rough guidance, not universal constants. A very tall full-page capture can exceed a limit and become blank or partially rendered.

Rank #3
2 Pack 64GB USB Flash Drive USB 2.0 Thumb Drives Jump Drive Fold Storage Memory Stick Swivel Design - Black
  • What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
  • Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
  • Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
  • Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
  • Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers

Reduce the rendering size

  • Capture a smaller element or split a long page into sections.
  • Lower scale instead of multiplying a large CSS area by a high device-pixel ratio.
  • Set windowWidth and windowHeight to the dimensions needed for the target, rather than an accidentally huge document size.
  • Test the same capture in another browser or on another machine to distinguish an application problem from a platform canvas limit.

Also verify that the target is not hidden, has nonzero dimensions, and is not being clipped by an ancestor with overflow rules. Those are layout problems, not random capture behavior.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Why doesn’t CSS property X render correctly or only partially?

html2canvas supports a defined subset of CSS. Unsupported or partially supported properties will remain unsupported regardless of timing, scale, or viewport settings. Consult the project’s supported-features reference, then isolate the suspected declaration by temporarily replacing it with a simpler equivalent. Commonly useful diagnostics include removing filters, complex blend effects, unusual generated content, or newer layout features one at a time.

If the requirement is the browser’s exact painted result—including every CSS effect—html2canvas may be the wrong method. It is a DOM reconstruction tool, not a native compositor capture.

Rank #4
SIMMAX 32GB Memory Stick USB 2.0 Flash Drives Swivel Thumb Drive Pen Drive (32GB Purple)
  • GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
  • BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
  • EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
  • TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
  • WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.

Viewport reports and the “different images” issue

GitHub issue #2947, opened on September 5, 2022, reports that “the screenshot taken with different viewports return different images.” The report describes Chrome 104.0.5112.102 on Windows 10 and includes an onclone customization. It is a useful example of the symptom, not proof that every varying capture has one root cause or that html2canvas is inherently random.

When you see this symptom, compare the actual viewport values, media-query branches, target dimensions, scroll offsets, and cloned-document changes. Setting windowWidth and windowHeight controls the rendering context; it does not make the source application’s data or UI state identical.

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

Choosing a different capture method

Need Better fit Reason
Client-side reconstruction of a selected DOM element html2canvas Runs in the page and can export a canvas, subject to CSS, CORS, and canvas limits.
Browser extension capture of what the user sees Native tab-capture API The browser can capture its painted tab rather than rebuilding DOM and CSS.
Server-side screenshots with high browser fidelity Puppeteer or Playwright The official FAQ recommends a real-browser tool for server-side work.
Hosted API with cleanup and repeatable automation ScreenshotNeo It accepts a URL, handles browser automation, and reports whether a response was billed.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. It loads the URL in a browser, accepts cookie or consent banners like a visitor, and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

One GET request returns PNG, JPEG, WebP, or a PDF. The API supports full-page captures with lazy images, CSS-selector element captures, dark mode, device presets or custom viewports, retina scale, PDF paper and page controls, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector or network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Parameter names used by other screenshot APIs also work.

Best Value
IMEASON Swivel Design 16GB USB Flash Drive with Keychain, USB 2.0 Portable Thumb Drive Memory Stick, FAT32 Format Flashdrive for Data Storage, Photos, Music, Files (Black, 16 GB)
  • 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
  • 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
  • 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
  • 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
  • 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

See the ScreenshotNeo documentation for parameters and response headers. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to try it.

Common failure modes and fixes

Symptom Likely cause Fix
Different dimensions on each click Device-pixel ratio, zoom, or viewport changed Set scale, windowWidth, and windowHeight.
Only animated regions differ Animation, transition, caret, or rotating content Disable it in onclone and capture a stable state.
Images are missing Cross-origin response lacks permission Configure server CORS, use useCORS, or use a proxy.
Output is blank or truncated Canvas limit or excessive scale Reduce area or scale and split long captures.
One CSS effect is wrong Unsupported or partial CSS implementation Check supported features or use a real-browser capture.
Capture starts before content appears Async application work is incomplete Wait on the application’s data and asset readiness signals.

FAQ

Is html2canvas random?

The documented behavior is deterministic for identical inputs, but the inputs often are not identical. Treat variation as evidence of changed state, environment, resources, or an implementation limit—not as a demonstrated random-number process.

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.

Can html2canvas capture a cross-origin image anyway?

No. The image server must permit the request through CORS, or the image must be supplied through a suitable proxy.

Should I use html2canvas for a backend screenshot service?

Usually not. Use a real-browser tool such as Puppeteer or Playwright, or a hosted browser screenshot API when you do not want to operate the browser infrastructure.

Frequently Asked Questions

Does calling html2canvas twice reuse the first canvas?

Each call reconstructs the target from the current DOM and rendering context. Reusing a canvas element does not freeze the page state; stabilize the inputs before every call.

Why does changing only browser zoom alter the image?

Zoom changes effective layout and often device-pixel scaling. Fix the viewport and html2canvas scale, and keep browser zoom constant when comparing outputs.

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

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.