Free tools Windows power users keep installed
One-click scans. No signup required.
html2canvas returns a canvas, not a file. Wait for the promise to resolve, encode the canvas as PNG (or another supported image type), then trigger an anchor download. For a normal-sized capture, the shortest working pattern is:
async function downloadElementAsPng(element, filename = 'screenshot.png') {
const canvas = await html2canvas(element);
const link = document.createElement('a');
link.download = filename;
link.href = canvas.toDataURL('image/png');
link.click();
}
Download the canvas after html2canvas finishes
Call the function from a user action, such as a button click. The element must exist when the function runs, and html2canvas must already be loaded.
<button id="download-button" type="button">Download PNG</button>
<script>
async function downloadElementAsPng(element, filename = 'screenshot.png') {
const canvas = await html2canvas(element);
const link = document.createElement('a');
link.download = filename;
link.href = canvas.toDataURL('image/png');
link.click();
}
document.querySelector('#download-button').addEventListener('click', async () => {
const element = document.querySelector('#capture');
try {
await downloadElementAsPng(element, 'profile-card.png');
} catch (error) {
console.error('Could not create the download:', error);
}
});
</script>
Replace #capture with the selector for the part of the page you want to export. The promise is important: calling toDataURL() before html2canvas(element) resolves means you do not yet have the finished rendering.
Why the anchor works
html2canvas reconstructs a representation of the DOM and CSS in a canvas. The canvas becomes an image only when you encode it. Setting the anchor’s download attribute supplies the filename, and setting href to the encoded data lets the browser start the download without navigating away.
#1 Best Overall
- 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
The result is a DOM-based rendering, not a literal browser screenshot. CSS or browser features that html2canvas does not implement, and content in inaccessible cross-origin frames, may look different or be absent.
Use a Blob for large captures
A data URL keeps the entire encoded image in a JavaScript string. That is convenient for small exports, but a large, full-page canvas can consume considerably more memory. For larger images, encode with toBlob(), create a temporary object URL, and revoke it after starting the download.
async function downloadElementAsPng(element, filename = 'screenshot.png') {
const canvas = await html2canvas(element);
const blob = await new Promise(resolve =>
canvas.toBlob(resolve, 'image/png')
);
if (!blob) {
throw new Error('Canvas could not be encoded as PNG');
}
const objectUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = filename;
link.href = objectUrl;
link.click();
URL.revokeObjectURL(objectUrl);
}
Do not revoke an object URL while code still needs to use it. If you display the generated image in a preview or let the user open it separately, keep the URL alive until that work is complete, then call URL.revokeObjectURL().
Choosing between toDataURL() and toBlob()
| Method | Best fit | Trade-off |
|---|---|---|
toDataURL() |
Small, one-off downloads and the shortest implementation | Builds the whole encoded image as a data URL string, which can use more memory for large images |
toBlob() plus an object URL |
Large or full-page exports | Needs asynchronous Blob handling and URL cleanup |
Set the output format and filename deliberately
PNG is the format used in the standard download example and preserves transparency when the canvas has transparent pixels. You can request another MIME type when the browser supports it:
const dataUrl = canvas.toDataURL('image/jpeg', 0.9);
const link = document.createElement('a');
link.download = 'capture.jpg';
link.href = dataUrl;
link.click();
The requested type is not guaranteed. If the browser cannot encode the requested format, toDataURL() can return PNG instead. Inspect the returned MIME prefix when the format matters:
Rank #2
- 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]
const dataUrl = canvas.toDataURL('image/webp');
console.log(dataUrl.slice(0, dataUrl.indexOf(',')));
// For example: data:image/webp;base64
Keep the extension consistent with the actual MIME type. If you need predictable output across browsers, request PNG and use a .png filename.
Make the download reliable in a real page
Start from a user gesture
Attach the operation to a click or another explicit user action. Browsers may restrict downloads created by timers, background callbacks, or code that is not connected to a user gesture. Keep the capture and anchor click in the same event flow.
Wait for content before capturing
Run the function only after the target element exists and its important images, fonts, and data have loaded. If your page inserts content asynchronously, disable the download button until the target is ready. An early capture can legitimately contain empty image boxes or loading placeholders.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteGive the user feedback
Large pages can take time to render and encode. Disable the button while the promise is pending, then restore it in a finally block:
const button = document.querySelector('#download-button');
button.addEventListener('click', async () => {
button.disabled = true;
try {
const target = document.querySelector('#capture');
const canvas = await html2canvas(target);
const blob = await new Promise(resolve =>
canvas.toBlob(resolve, 'image/png')
);
if (!blob) throw new Error('PNG encoding failed');
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = 'capture.png';
link.href = url;
link.click();
URL.revokeObjectURL(url);
} catch (error) {
console.error(error);
alert('The image could not be downloaded. Check the console for details.');
} finally {
button.disabled = false;
}
});
Fix missing remote images and the tainted-canvas error
The most common export failure is a security exception when the canvas contains an image from another origin. A canvas becomes tainted when the browser cannot verify that the cross-origin content is allowed. A tainted canvas may still appear on screen, but browser security rules prevent reading its pixels with toDataURL() or toBlob().
Rank #3
- 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
Use CORS when the image server permits it
The remote image server must send an appropriate Access-Control-Allow-Origin response header. When it does, request CORS-enabled images from html2canvas:
const canvas = await html2canvas(document.querySelector('#capture'), {
useCORS: true
});
const blob = await new Promise(resolve =>
canvas.toBlob(resolve, 'image/png')
);
if (!blob) throw new Error('Canvas could not be encoded');
useCORS is false by default. Enabling it does not grant permission by itself; the image host still has to opt in with its response headers. Check the browser Network panel for the image response and its CORS headers.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhen CORS is unavailable
If the image server does not allow your origin, you need to serve the image through a proxy that adds the appropriate CORS response, or use a same-origin copy. You cannot solve the policy restriction in client-side JavaScript alone.
Setting allowTaint: true does not make a tainted canvas readable. It may allow rendering behavior in some cases, but the browser will still block pixel export. Do not treat it as a workaround for a failed toDataURL() or toBlob() call.
Cross-origin iframes are a separate limitation
html2canvas cannot inspect a cross-origin iframe when browser security rules prevent access to that frame’s DOM. Capture the content from the page that owns it, arrange a same-origin integration, or omit it from the export.
Rank #4
- 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.
Understand what html2canvas can and cannot reproduce
- It paints from DOM and CSS information rather than copying the browser’s composited pixels.
- Unsupported CSS or browser features can produce a visual difference even when no error is thrown.
- Images that fail to load, load after the capture starts, or are blocked by CORS may be missing.
- A very large element creates a very large canvas; memory pressure can make encoding slow or fail.
- Canvas pixels must remain origin-clean before either export method can read them.
For a pixel-identical browser capture, especially when the page includes third-party frames or browser chrome, a browser automation or screenshot service is a better fit than a DOM renderer.
Recommended Free Tools
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
SecurityError from toDataURL() or toBlob() |
A cross-origin image tainted the canvas | Configure useCORS: true and ensure the image server sends Access-Control-Allow-Origin; otherwise use a CORS-capable proxy or same-origin asset |
| Remote images are blank | The image was blocked, failed, or was not loaded before capture | Verify the image URL and Network response, wait for the image to load, and resolve CORS before calling html2canvas |
| The downloaded file is PNG despite requesting another type | The browser does not support the requested encoder | Inspect the data URL MIME prefix and use the matching extension, or request PNG for predictable output |
| The file is huge or the tab becomes sluggish | A large canvas plus a data URL consumes substantial memory | Use toBlob() and an object URL; capture only the required element and avoid unnecessary dimensions |
| Nothing downloads | The code ran outside a user gesture, the anchor has no href, or an exception occurred before the click |
Call it from a click handler, log errors, and verify that encoding returned a value |
| An iframe or complex effect is missing | html2canvas cannot access the frame or does not implement that rendering feature | Capture same-origin content, change the page structure, or use a browser-based screenshot service |
Or skip the browser setup
If you need a screenshot of a public URL rather than a DOM element inside your current page, ScreenshotNeo provides a one-request website screenshot API. It accepts the cookie or consent banner like a visitor, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and bills only clean shots. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server also gives Claude, Cursor, and other MCP clients take_screenshot, get_page_info, and capture_pdf tools.
The API supports PNG, JPEG, WebP, and PDF output. You can request full-page captures with lazy images loaded, a CSS-selected element, dark mode, device presets or custom viewports, retina scale, PDF paper and page settings, custom CSS and JavaScript, clicks, selector waits, delays, network-idle waits, request or resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, and usage data. Existing screenshot-API parameter names also work, which can simplify migration.
Here is the one-call example; the ScreenshotNeo documentation lists the request options and response headers.
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(`Screenshot failed: ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('node:fs').writeFileSync('shot.webp', buffer);
ScreenshotNeo’s Free plan includes 1,000 screenshots each month without a card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and annual billing gives two months free. Create a free ScreenshotNeo account to get the API key.
Performance, reliability, and cost considerations
Browser-side html2canvas
- There is no screenshot-service charge, but rendering and encoding consume the visitor’s CPU and memory.
- Limit the capture to the required element instead of an entire long document when possible.
- Prefer Blob output for large images and release object URLs when finished.
- Wait for content deterministically so retries do not produce different partial images.
- Keep CORS configuration under the control of the image host or your proxy; client code cannot override a server’s policy.
When a service is a better operational choice
Use a server-side screenshot API when captures must run outside a user’s browser, need repeatable device and timing settings, include pages with consent overlays that should be removed, or must be generated in bulk. ScreenshotNeo reports whether a request produced a clean page and whether it was billed, so failed loads and bot checks do not consume paid shots.
Best Value
- 【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.
FAQ
Frequently Asked Questions
Can I download the canvas without converting it first?
No. A canvas is an in-memory drawing surface. Encode it with toDataURL() or toBlob(), then give the resulting data URL or object URL to a downloadable link.
Why does the image look different from the page?
html2canvas rebuilds the view from DOM and CSS data; it is not a pixel capture of the browser compositor. Unsupported CSS, inaccessible frames, and unavailable images can therefore differ or disappear.
Does allowTaint solve a SecurityError?
No. A tainted canvas remains unreadable to export APIs. The image host must permit CORS, or the asset must be served through a suitable same-origin or CORS-enabled proxy.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →When should I use ScreenshotNeo instead?
Use it when you need URL-level, server-side captures, PDF output, repeatable waits and device settings, consent and popup removal, or automation through an MCP client rather than a canvas inside the current page.
Quick Recap
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.

