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

Use scale: window.devicePixelRatio for a sharp, display-matched capture, or set an explicit scale when you need predictable pixel dimensions. A larger scale increases bitmap resolution, but it cannot repair unsupported CSS, cross-origin security restrictions, or the DOM reconstruction limits of html2canvas.

What html2canvas scale actually changes

html2canvas renders a DOM element into an HTML canvas. The scale option controls the number of canvas pixels used for each CSS pixel. If an element is 800 CSS pixels wide and the scale is 2, the resulting bitmap is approximately 1,600 pixels wide (before any browser limits or other sizing options apply).

The documented default is window.devicePixelRatio. That is why the same code generally looks sharper on a Retina or other high-DPI display than on a standard-density monitor. The official high-DPI example passes that value explicitly:

const canvas = await html2canvas(element, {
  scale: window.devicePixelRatio,
});

Use an explicit number when output dimensions must be repeatable across machines. Do not assume that a larger number is always better: memory use, rendering time and canvas-size limits rise with the number of pixels.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Scale choices at a glance

Setting Best use Trade-off
window.devicePixelRatio Sharp output that follows the current display Pixel dimensions vary by device and browser zoom
1 Small files and predictable CSS-pixel-sized output Can look soft on high-density displays
2 or another fixed value Consistent exports for reports, previews or tests Four times as many pixels as scale 1 at scale 2, increasing memory pressure

Capture an element and download a sharp PNG

After loading html2canvas in your page, select the element, render it and turn the returned canvas into a download. This follows the project’s official element-capture and PNG pattern:

async function downloadCard() {
  const element = document.querySelector('#invoice-card');
  if (!element) {
    throw new Error('Could not find #invoice-card');
  }

  const canvas = await html2canvas(element, {
    scale: window.devicePixelRatio,
  });

  const link = document.createElement('a');
  link.download = 'invoice-card.png';
  link.href = canvas.toDataURL('image/png');
  link.click();
}

document.querySelector('#download-button')
  .addEventListener('click', downloadCard);

The canvas dimensions are independent of the element’s CSS width and height after rendering. Inspect canvas.width and canvas.height if another system requires exact dimensions. If you need a JPEG instead, use canvas.toDataURL('image/jpeg', quality); PNG is usually the safer default for text, lines and transparency.

Make output dimensions predictable

For an export pipeline, choose a fixed scale and keep the capture viewport consistent. For example:

const element = document.querySelector('.receipt');
const scale = 2;
const canvas = await html2canvas(element, {
  scale,
  backgroundColor: '#ffffff',
  logging: false,
});

console.log({
  cssWidth: element.getBoundingClientRect().width,
  cssHeight: element.getBoundingClientRect().height,
  pixelsWide: canvas.width,
  pixelsHigh: canvas.height,
});

A fixed scale does not freeze the layout by itself. Fonts, responsive breakpoints, browser zoom, loaded assets and the element’s computed size can still change the result. Set the page or component to the intended viewport before capturing, wait until fonts and images are ready, and record the resulting canvas dimensions in automated jobs.

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

Capture tall or scrolling content

For a long element, the html2canvas FAQ recommends setting the virtual window dimensions to the element’s scroll dimensions:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
const element = document.querySelector('#long-page');
const canvas = await html2canvas(element, {
  scale: 1,
  windowWidth: element.scrollWidth,
  windowHeight: element.scrollHeight,
});

Combine those dimensions with a higher scale only after testing the target browsers. A long page multiplied by scale 2 can exceed the canvas area even when each individual CSS dimension looks reasonable. A blank, clipped or partially rendered result is often a size-limit symptom rather than a CSS problem.

Approximate browser limits

The html2canvas FAQ lists rough, browser-dependent guidance rather than guaranteed standards: Chromium is shown at about 32,767 pixels per dimension and 268 megapixels of area; Firefox at about 32,767 pixels and 472 megapixels; desktop Safari at about 32,767 pixels per dimension. iOS Safari is lower and depends on device RAM. Browser versions, operating systems and available memory change these limits, so treat the figures as test thresholds, not promises.

If a capture approaches those boundaries, lower scale, split the page into sections, or export several canvases and assemble them in a format designed for long documents. Testing on the least capable device you support is essential.

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

Why a higher scale cannot make every page pixel-perfect

html2canvas does not take the browser’s compositor screenshot. It traverses the DOM and builds a new representation from information available to JavaScript. Only CSS properties implemented by the library render correctly. Increasing scale samples that reconstruction at more pixels; it does not add support for an unimplemented property, browser chrome, video frames or a missing font.

Cross-origin iframes cannot be rendered because of browser security restrictions. A page can therefore contain an iframe that remains empty even when the rest of the element is sharp. If you need a literal browser view, including content outside the DOM reconstruction model, use a browser screenshot API or a headless browser instead.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Fix missing or tainted images with CORS

Remote images are a frequent cause of missing content or a security error when calling toDataURL(). The image server must allow your page’s origin with an appropriate Access-Control-Allow-Origin response header. Then enable CORS loading:

const canvas = await html2canvas(document.querySelector('#gallery'), {
  scale: window.devicePixelRatio,
  useCORS: true,
});

useCORS defaults to false. Setting it does not grant permission: the remote server still has to send the header, and redirects can change the final origin. When you control neither server, use a same-origin proxy that fetches the image and returns it with suitable headers, subject to that service’s terms and security review. Scaling cannot bypass the browser’s same-origin policy.

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.

Reliable capture workflow

  1. Choose the target. Select the smallest element that contains the content you need. Capturing the whole document increases memory use.
  2. Stabilize the layout. Apply the intended viewport, wait for web fonts, images and asynchronous data, and disable animations or blinking cursors when deterministic output matters.
  3. Pick the scale. Start with window.devicePixelRatio for display-quality output. Use a fixed value for reproducible exports, and lower it for very large surfaces.
  4. Configure cross-origin assets. Use useCORS: true only when the image server permits your origin; otherwise provide a controlled proxy.
  5. Render and inspect. Check canvas.width, canvas.height and the visual result before downloading or uploading it.
  6. Release resources. Remove temporary canvases or references after processing large captures so the browser can reclaim memory.

Troubleshooting common failures

The image is sharp but still looks wrong

That is usually a rendering-support issue, not a scale issue. Check unsupported CSS, pseudo-elements, web-font timing and cross-origin iframes. Compare a simplified test element to identify which feature is missing.

The downloaded file is blank or only partly present

Reduce the scale and capture area, then test the target browser. Long-page dimensions can exceed per-dimension or total-area limits. For very tall content, capture sections separately.

Images disappear

Inspect the image responses for Access-Control-Allow-Origin, set useCORS: true, and verify that redirects preserve permission. Use a same-origin proxy when the image host cannot be changed.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

toDataURL() throws a security error

An image has probably tainted the canvas. Resolve its CORS headers or remove that asset before export; changing scale does not alter this security rule.

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

The result changes between computers

The default device-pixel-ratio scale, responsive layout, browser zoom, fonts and available assets may differ. Set a fixed scale and viewport, bundle or preload required fonts, and run captures in the same browser configuration for repeatable output.

The browser becomes unresponsive

Reduce the element size or scale, avoid capturing hidden full-page containers, and process large pages in tiles. A high-resolution canvas consumes memory proportional to its pixel area.

When html2canvas is the wrong capture layer

The library runs in the user’s browser and depends on browser APIs; it is client-side only. For server-side screenshot generation, the html2canvas FAQ points developers toward Puppeteer or Playwright. In browser extensions, native screenshot APIs are recommended as more reliable and without canvas-size limits. These approaches capture the browser’s rendered output rather than reconstructing selected DOM and CSS in a canvas, but they require a browser runtime and a different deployment model.

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 you need a hosted screenshot instead of a client-side canvas, ScreenshotNeo returns a PNG, JPEG, WebP or PDF from one GET request. Its cleanup steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. It also provides an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.

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

See the ScreenshotNeo API documentation for all options. A cURL request:

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
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}`);
const fs = require('fs');
fs.writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));

Every feature is included on every plan: full-page lazy-image loading, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

Frequently Asked Questions

Does changing scale change the element’s CSS size?

No. It changes the canvas bitmap resolution; the page layout and CSS dimensions remain unchanged.

Should I always use scale 2 for retina output?

No. The documented default is window.devicePixelRatio. A fixed value such as 2 is appropriate only when its predictable dimensions and extra memory use fit your capture target.

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

Can html2canvas capture content inside a cross-origin iframe?

No. Browser security restrictions prevent html2canvas from reading cross-origin iframe content.

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.