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.

Set html2canvas’s scale option when you render, then call toDataURL() on the returned canvas. Use scale: 1 when CSS pixels must become the exact canvas dimensions; use window.devicePixelRatio (the library default) or another deliberate value for a sharper, supersampled image.

const element = document.querySelector('#capture');

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

const dataUrl = canvas.toDataURL('image/png');

The important detail is that scaling happens during rendering. Resizing the canvas after html2canvas() has finished cannot recreate detail that was never rendered.

What scale changes

html2canvas reconstructs the selected DOM element in a canvas. The scale configuration controls the rendering resolution: a CSS region rendered at 800 by 600 with scale: 1 produces an 800 by 600 canvas, while scale: 2 renders about 1,600 by 1,200 pixels. The CSS layout can remain the same on screen; only the internal bitmap gets more pixels.

More pixels generally make text, borders and fine artwork look sharper when the exported image is displayed at its CSS size or printed. They also increase the work required to paint, the canvas memory footprint and the amount of data passed to the encoder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Wacom Intuos Small, Wired Graphic Drawing Tablet with Pen + Software
  • Wacom Intuos Small Graphics Drawing Tablet: Enjoy industry leading tablet performance in superior control and precision with Wacom's EMR, battery free technology that feels like pen on paper
  • Works With All Software: Wacom Intuos tablet can be used in any software program to explore new facets of digital creativity; draw, paint, edit photos/videos, create designs, and mark up documents
  • What the Professionals Use: Wacom's industry leading pen technology and pen to paper feeling makes it the preferred drawing tablet of professional graphic designers
  • Software and Training Included: Only Wacom gives you software with every purchase. Register your Intuos tablet and gain access to some of the best creative software and Wacom's online training
  • Wacom is the Global Leader in Drawing Tablet and Displays: For over 40 years in pen display and tablet market, you can trust that Wacom to help you bring your vision, ideas and creativity to life

Choose the scale for the result you need

  • scale: 1: Use this for predictable one-CSS-pixel-to-one-canvas-pixel output and for a fixed pixel contract.
  • scale: window.devicePixelRatio: A practical high-DPI choice. On a device-pixel-ratio 2 display, the same CSS area is rendered at roughly twice the width and height.
  • A value below 1: Reduces pixel count and memory use when a thumbnail or small preview is sufficient, with a corresponding loss of detail.
  • A chosen value above 1: Supersamples consistently across machines, but can make large captures expensive. Pick a limit that fits your target dimensions rather than blindly using the largest number.

Exact dimensions versus sharper output

Decide whether your priority is a pixel size or visual density before writing the options.

Goal Configuration What to expect
Canvas pixels equal the CSS dimensions scale: 1 An element laid out at 800 × 600 CSS pixels yields approximately 800 × 600 canvas pixels.
Sharper image at the same displayed size scale: window.devicePixelRatio On a DPR 2 display, the canvas is approximately twice as wide and twice as tall as the CSS region.
Known output dimensions Set width, height and scale: 1 Use when a downstream system requires a fixed 800 × 600-style bitmap.
Small preview or constrained memory A scale below 1 Fewer pixels and a smaller encode, at the cost of detail.

“Approximately” matters because layout can include fractional CSS pixels, borders, transforms and other browser rounding. Always inspect the actual canvas.width and canvas.height attributes rather than inferring them from CSS.

Set a fixed output size

If the consumer requires a particular bitmap size, provide dimensions to html2canvas and keep the scale explicit:

const element = document.querySelector('#capture');

const canvas = await html2canvas(element, {
  width: 800,
  height: 600,
  scale: 1
});

console.log(canvas.width, canvas.height); // Check the actual result
const dataUrl = canvas.toDataURL('image/png');

width and height describe the capture area in CSS pixels. The resulting attributes are the authoritative export dimensions. If the element is naturally smaller or larger, verify the rendered result and adjust the capture region or layout rather than assuming the options will crop or stretch every child exactly as intended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
XPPen Deco 01 V3 10x6 Drawing Tablet, 16K Battery-Free Stylus, 8 Keys
  • Word-first 16K Pressure Levels: The upgraded stylus features 16,384 levels of pressure sensitivity and supports up to 60 degrees of tilt, delivering smoother lines and shading for a natural drawing experience. With no battery or charging needed, it operates like a real pen, making it easy for beginners to create effortlessly. This functionality helps novice artists develop their skills and explore their creativity without the intimidation of complex tools
  • Designed for Beginners: This drawing pad desinged with 8 customizable shortcuts for both right and left-hand users, express keys create a highly ergonomic and convenient work platform
  • Perfectly Adapted for Android: The XPPen Deco 01 V3 art tablet supports connections with Android devices running version 10.0 and above. It is recommended to download the XPPen Tools Android application, which adapts to your smartphone's screen aspect ratio, ensuring accurate mapping. It also supports mapping on Android screens with different aspect ratios in portrait mode
  • Large Drawing Space, Bigger Bold Inspiration: This expansive drawing pad has10 x 6.25-inch helps you break through the limit between shortcut keys and drawing area
  • Easy Connectivity for Beginners: The Deco 01 V3 offers USB-C to USB-C connectivity, plus adapters for USB C. This ensures easy connection to various devices, allowing beginner artists to set up quickly and focus on their creativity without compatibility concerns. Whether using a laptop, tablet, or desktop, the Deco 01 V3 provides a seamless experience, making it an ideal choice for those just starting their digital art journey

Inspect dimensions before exporting

Debug size problems immediately after rendering:

const canvas = await html2canvas(document.querySelector('#capture'), {
  scale: 1
});

console.log({
  pixelWidth: canvas.width,
  pixelHeight: canvas.height,
  cssWidth: canvas.width / 1,
  cssHeight: canvas.height / 1
});

const dataUrl = canvas.toDataURL('image/png');

When using another scale, divide by that scale only as a rough comparison to the intended CSS area; the canvas attributes remain the source of truth. Check them in the same browser and viewport that will run the export, because responsive layout and device-pixel ratio affect the result.

Export with toDataURL()

PNG for lossless detail

PNG is the straightforward lossless choice for interfaces, text, diagrams and screenshots:

const canvas = await html2canvas(document.querySelector('#capture'), {
  scale: window.devicePixelRatio
});
const dataUrl = canvas.toDataURL('image/png');

The returned value is a data URL containing the encoded image. It is convenient for an <img> element or a small download, but it keeps the entire encoded image in a JavaScript string.

JPEG or another supported type

The Canvas API accepts a MIME type and, for formats such as JPEG, a quality value from 0 to 1:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Tablet, 11 Inch Android 16 Tablets with Keyboard Gemini AI 3.5, 24GB+128GB
  • 【Android 16 Tablet with Gemini AI 3.5】The 11 inch TABWEE T90 brings a cleaner, smarter tablet experience for work, study and home use. Android 16 adds a simpler lock screen, customizable Quick Settings, improved video calls with background blur and portrait light, easier cloud photo selection and enhanced Linux terminal support. With Gemini AI 3.5, you can search, translate, summarize notes, organize ideas and plan tasks more efficiently—ideal for online classes, reading, video calls and light office work
  • 【11 Inch FHD IPS Display for Streaming, Reading and Learning】Enjoy a bigger and clearer viewing experience on the 11 inch FHD display with 1920 x 1200 resolution and an 84.9% screen-to-body ratio. The fully laminated TDDI screen delivers more natural colors, smoother touch response, and a more immersive feel when watching movies, reading documents, viewing recipes, or studying online. With Widevine L1 support, dual smart speakers, and 380-nit brightness, this Android tablet is ideal for Netflix-style streaming, YouTube, music, eBooks, online lessons, and comfortable indoor entertainment
  • 【24GB RAM + 128GB ROM, More Space for Daily Needs】Android 16 tablet comes with up to 24GB RAM, including 8GB built-in RAM and 16GB virtual memory expansion, helping daily apps run smoothly for browsing, video watching, note-taking, email, and study apps. The 128GB ROM provides plenty of room for photos, documents, music, videos, learning materials, and work files. Need more storage? The TF card slot supports up to 2TB expansion, so you can keep more movies, books, files, and family memories without constantly deleting content. Memory expansion path: Settings > System > Memory Expansion
  • 【T615 Octa-Core + 8000mAh Battery for Long Days】Powered by the Unisoc T615 octa-core processor, T90 delivers reliable everyday speed for streaming, video calls, online lessons, reading, emails and document editing. The 8000mAh battery supports up to 11H video playback, 8H daily entertainment or 40H music, while smart power management helps reduce background drain, making it ready for flights, commutes, study sessions and busy workdays
  • 【13MP Camera with Google Lens】The 13MP rear camera works with Google Lens to make daily tasks easier. Scan documents, translate text, identify objects, search products, capture handwritten notes, or save useful information in seconds. The 5MP front camera is suitable for video calls and clear face-to-face communication. With dual-band 5G WiFi, Bluetooth 5.0, and support for GPS, GLONASS, Galileo, and Beidou, this Android tablet offers fast downloads, stable wireless connections, easy accessory pairing, and reliable location support for travel, maps, and mobile use
const canvas = await html2canvas(document.querySelector('#capture'), {
  scale: 1
});
const jpegUrl = canvas.toDataURL('image/jpeg', 0.85);
const webpUrl = canvas.toDataURL('image/webp', 0.85);

JPEG is useful when photographic content and a smaller file matter more than lossless text edges. Browser support for an output type is not guaranteed; if the requested type is unsupported, browsers fall back to PNG. Treat the returned URL’s MIME prefix as the final indication of what was produced.

Use toBlob() for large captures

toDataURL() creates the whole encoded image in memory and can produce a very long string. For large images, use a Blob and an object URL instead:

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

canvas.toBlob((blob) => {
  if (!blob) {
    throw new Error('The browser could not encode the canvas');
  }

  const objectUrl = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = objectUrl;
  link.download = 'capture.png';
  link.click();
  URL.revokeObjectURL(objectUrl);
}, 'image/png');

This avoids placing the entire encoded file in a data URL. Keep the object URL alive until the browser has started using it; revoke it afterward.

How scale affects memory and performance

Scale multiplies both dimensions, so pixel count grows roughly with the square of the scale. Doubling the scale is not a two-percent adjustment: it can require about four times as many pixels for the same CSS area. Painting, transferring and encoding therefore take longer, and a very large canvas can exhaust browser limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Wacom Intuos Medium, Bluetooth Graphic Drawing Tablet with Pen + Software
  • Wacom Intuos Medium Bluetooth Graphics Drawing Tablet: Enjoy industry leading tablet performance in superior control and precision with Wacom's EMR battery free technology that feels like pen on paper
  • Works With All Software: Wacom Intuos tablet can be used in any software program to explore new facets of digital creativity; draw, paint, edit photos/videos, create designs, and mark up documents
  • Wireless Superior Connectivity: Connect wirelessly via Bluetooth or directly using USB-A cable which enables you to work, draw or create whether it's at a desk, on the sofa, in classrom or even outside
  • Software and Training Included: Only Wacom gives you software with every purchase. Register your Intuos tablet and gain access to some of the best creative software and Wacom's online training
  • Wacom is the Global Leader in Drawing Tablet and Displays: For over 40 years in pen display and tablet market, you can trust that Wacom to help you bring your vision, ideas and creativity to life
  • Start with scale: 1 to establish a working baseline.
  • Increase to the device pixel ratio or a smaller fixed value only if the result needs more detail.
  • Capture the smallest useful element instead of an entire page when possible.
  • Prefer toBlob() for large output and avoid retaining multiple data URLs at once.
  • Measure canvas.width, canvas.height, encode time and file size in the target browsers.

Cross-origin images and tainted canvases

html2canvas cannot bypass the browser’s same-origin protections. An image loaded from another origin must provide a suitable Access-Control-Allow-Origin response header if you want to draw it and export the canvas. You can ask html2canvas to attempt CORS loading:

const canvas = await html2canvas(document.querySelector('#capture'), {
  scale: 1,
  useCORS: true
});
const dataUrl = canvas.toDataURL('image/png');

useCORS: true is not a workaround by itself. It works only when the image server permits your page’s origin (or otherwise sends an appropriate CORS header). If it does not, serve the asset through a same-origin proxy you control, replace it with a same-origin copy, or omit that asset. Drawing a disallowed image can taint the canvas, after which export may throw a security error or become unreadable.

Fidelity limits of html2canvas

html2canvas is a DOM reconstruction tool, not the browser’s native screenshot facility. It draws the properties and resources it understands, so unsupported CSS, unusual filters, complex blending, video frames, browser chrome and some form-control details can differ from the live page. Raising scale improves sampling of what html2canvas rendered; it cannot make an unsupported property appear or correct a layout mismatch.

For a faithful check, compare the export at the same viewport, loaded-font state and responsive breakpoint as the page you are testing. Wait until images and fonts needed by the element are available before invoking html2canvas, and capture a specific element when full-page layout introduces unnecessary complexity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Wacom Intuos Pro Medium, Bluetooth Graphic Drawing Tablet with ProPen 3
  • WACOM’S BEST PEN TECHNOLOGY: Pro Pen 3 offers amazing precision, 8192 pressure levels, tilt support & lag-free tracking for smooth, precise strokes; choose slim, straight or flared grip, adjust balance & button layout for precision and comfort
  • DIAL INTO PRODUCTIVITY: Speed up and stay in the creative flow with 10 customizable tablet ExpressKeys & 2 mechanical dials conveniently located at the top of the tablet and close to your keyboard for efficiency
  • DESIGNED FOR MODERN MONITORS: With a versatile 16:9 format perfect for multiple monitors and wide displays; medium size has a large active area with a small footprint 11.4 x 8.1” / 291 x 206 mm
  • SLEEK AND STURDY: Measuring 4mm at its thinnest this professional-grade drawing tablet feels like pen-on-paper on your desk, combined with the robust durability of magnesium making it equally suited for your office or life on the go
  • WIRELESS FREEDOM: use Intuos Pro with USB or connect wirelessly via Bluetooth to multiple computers with a simple switch
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Canvas-size failures and the data:, result

Browsers impose maximum canvas dimensions. If a canvas has zero width or height, or exceeds the browser’s maximum, toDataURL() can return the literal data:, value instead of an image. This is a size failure, not evidence that PNG encoding succeeded.

  1. Log canvas.width and canvas.height.
  2. Lower scale and try again.
  3. Capture a smaller region or split a long page into sections.
  4. Use toBlob() for the remaining large exports.

Common problems and fixes

Symptom Likely cause Fix
Image looks blurry Internal resolution is too low for its display size. Increase scale or use window.devicePixelRatio; confirm the image is not being enlarged again by CSS.
Export has unexpected dimensions Device-pixel ratio, fractional layout or explicit width/height differs from your assumption. Inspect canvas.width and canvas.height; use scale: 1 for a CSS-pixel contract.
SecurityError during export A cross-origin image tainted the canvas. Use useCORS: true only with server-side CORS headers, or proxy the asset through your origin.
Returned value is data:, Zero dimensions or a canvas beyond browser limits. Reduce scale, reduce the capture region or split the capture.
Large page freezes or crashes Too many pixels and an in-memory data URL. Lower scale, capture in pieces, use toBlob() and release object URLs.
CSS differs from the page html2canvas does not implement every browser-rendered feature. Simplify unsupported styling, provide alternatives, or use a browser screenshot service when native rendering is required.

Or skip the browser setup

If you need a rendered website image rather than a canvas inside your own page, ScreenshotNeo accepts one request and returns PNG, JPEG, WebP or PDF. It handles the browser session for you and can apply options such as full-page capture with lazy images loaded, element selection by CSS selector, dark mode, device presets or custom viewports, retina scale, custom CSS and JavaScript, click-before-capture, selector waits, delays, network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed image links, asynchronous jobs with signed webhooks and bulk capture of up to 100 URLs per call. The API also accepts parameter names used by other screenshot APIs, which can simplify migration. See the ScreenshotNeo API documentation for the complete option list.

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

Cookie banners, newsletter popups and chat widgets are removed before the shot. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. 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.

Equivalent requests in Python and Node.js

These examples call the same endpoint and save the response bytes. The API key and target URL are the only values you need to replace.

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

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(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Practical decision checklist

  • Need exact CSS-to-pixel dimensions? Set scale: 1 and verify the canvas attributes.
  • Need a sharper image at its displayed size? Use the device pixel ratio or a measured fixed scale.
  • Need a smaller file? Lower scale, choose JPEG/WebP where appropriate, or reduce quality.
  • Seeing missing images or export security errors? Resolve CORS before changing scale.
  • Hitting memory or maximum-dimension limits? Reduce the region or scale, split the job and prefer toBlob().
  • Need a native browser rendering workflow outside your page? Use ScreenshotNeo’s API or MCP server instead of adding browser automation to your application.

Frequently Asked Questions

Does changing CSS width after rendering change the exported pixel dimensions?

No. The exported dimensions are set by the canvas bitmap created by html2canvas. Set the render options first and verify canvas.width and canvas.height.

Is a higher scale always better?

No. It can sharpen detail, but it also increases pixel count, memory use, encoding time and the chance of exceeding browser canvas limits.

Can html2canvas capture a page exactly like a browser screenshot?

Not always. It reconstructs supported DOM and CSS into a canvas, so unsupported styling and some browser-rendered content can differ.

The Bottom Line

Set scale while calling html2canvas: use 1 for exact CSS-pixel dimensions, or a deliberate higher value such as window.devicePixelRatio for sharper output. Check the actual canvas dimensions, resolve CORS first, and switch to toBlob() or a smaller capture when memory and canvas limits become the problem.

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.