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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If html2canvas turns a rounded element into a rectangle, do not assume border-radius is unsupported. html2canvas rebuilds an image from the DOM and CSS it can read rather than copying the browser’s final pixels, so a mismatch can come from an incomplete property implementation or an interaction with shadows, borders, transforms, clipping, or nested layout. Confirm the exact version, reduce the case to one element, and compare the documented foreignObjectRendering mode before filing a reproducible issue.

Why rounded corners can become square in html2canvas

The live page is painted by the browser’s full rendering engine. html2canvas instead traverses the DOM, reads styles, and constructs a canvas representation. Its documentation warns that the result may not be 100% identical to the browser’s real rendering: every CSS property needs an individual implementation. Therefore, a page can look correct on screen while the generated canvas loses a radius or clips it differently. See the project’s DOM-reconstruction explanation.

border-radius appears on the project’s supported-property list, but “supported” does not promise that every combination of radius values, borders, shadows, images, transforms, overflow, and nested elements behaves exactly like the browser. The project’s FAQ states: “Every CSS property must be manually implemented to render correctly, so html2canvas will never have full CSS support.” Read that qualification in the official FAQ.

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

Fix it systematically

1. Record the version and rendering context

Check the version actually resolved by your package manager and lockfile; do not rely on the version you intended to install. Historical changelog entries include fixes for radius behavior, including values above 50% and a top-right-radius issue, so the release matters, although upgrading cannot be promised as a universal fix. Use the latest release when making a report, as the project requests in its issue guidance.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
  • Record the html2canvas version and whether you used the non-minified build.
  • Record browser name and version, operating system, viewport, device-pixel ratio, and whether the page is same-origin.
  • Write down the element’s width and height, every border-radius value, and whether borders, shadows, transforms, overflow, images, pseudo-elements, or nested children are involved.
  • Save console output and the actual canvas produced by the failing case.

The project lists current Chrome/Chromium, Firefox, and Safari as supported modern evergreen browsers. The available material does not identify one browser as the general cause of square corners.

2. Build a one-element reproduction

Start with a solid block and one simple radius. Render only that element. This tells you whether the problem is the radius itself or an interaction with the rest of the component.

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>html2canvas radius test</title>
  <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
  <style>
    #card {
      width: 240px;
      height: 120px;
      background: #4b78d1;
      border-radius: 16px;
      color: white;
      display: grid;
      place-items: center;
      font: 16px system-ui, sans-serif;
    }
  </style>
</head>
<body>
  <div id="card">Rounded test</div>
  <script>
    (async () => {
      const element = document.querySelector('#card');
      const canvas = await html2canvas(element);
      document.body.appendChild(canvas);
    })().catch(console.error);
  </script>
</body>
</html>

If this works, add your original styles back one at a time: first the border, then shadow, image, overflow, transforms, pseudo-elements, and nested content. The first change that makes the corners square is the useful lead. If this minimal case fails, keep the isolated HTML, CSS, rendered image, version, and browser details for an upstream report.

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

3. Try the alternate renderer as a comparison

The configuration reference documents foreignObjectRendering. It defaults to false and asks the browser to render supported HTML inside an SVG foreign object. It is an experiment, not a guaranteed radius fix:

Rank #2
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
const element = document.querySelector('#card');
const canvas = await html2canvas(element, {
  foreignObjectRendering: true
});
document.body.appendChild(canvas);

Run the same minimal case with the default and alternate settings in the target browser. Compare the corners, console messages, fonts, images, and any other visual differences. Browser support for foreign-object rendering is a prerequisite, and behavior can differ between engines.

4. Inspect the cloned document with onclone

html2canvas renders a cloned document. The documented onclone callback lets you inspect or alter that clone without changing the live page. Logging the computed radius can reveal whether a style is present in the cloned context:

const canvas = await html2canvas(document.querySelector('#card'), {
  onclone(clonedDocument) {
    const clonedElement = clonedDocument.querySelector('#card');
    console.log(getComputedStyle(clonedElement).borderRadius);
  }
});
document.body.appendChild(canvas);

Use this to test a hypothesis, not as a radius-specific workaround. If the computed value is unexpected, check stylesheet order, media queries, CSS variables, and selectors that depend on a class or ancestor not present in the cloned subtree.

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

5. Isolate shadows and other clipping interactions

Temporarily remove box-shadow and capture again. Issue #2953 describes a narrow case in which a black border artifact disappeared when the reporter removed the shadow while retaining the radius. That report concerns an unwanted dark outline, not proof that shadows explain every rectangular-corner result. If removing the shadow changes nothing, restore it and test borders, transforms, overflow, filters, and pseudo-elements separately.

Common style interactions to test

Interaction Diagnostic change What the result tells you
Shadow Set box-shadow: none A change points to a shadow/radius rendering interaction; it does not establish a universal shadow bug.
Border Set border: 0, then restore each side Shows whether border painting, width, or style changes the corner geometry.
Clipping Toggle overflow: hidden Separates the element’s own radius from clipping of children or images.
Transforms Remove transform and capture at the original size Reveals whether transformed geometry is being reconstructed differently.
Nested content Replace children with plain text Identifies an image, pseudo-element, or child background that visually fills the corners.
Radius syntax Replace shorthand with four explicit corner values Shows whether one corner or an elliptical value is the trigger.

Useful configuration checks

Keep the capture target stable while changing one option. Ensure the target is in the document, has non-zero dimensions, and is not hidden by a display rule at capture time. Wait for fonts and images before rendering if they affect the component’s size. If the page changes after a framework update, compare the computed styles immediately before calling html2canvas.

Do not “fix” the screenshot by permanently replacing the radius with a raster background unless you accept the loss of responsive styling. A temporary diagnostic style can prove whether the geometry is the trigger, but the durable fix should address the interaction or the renderer limitation.

When to report an unresolved case

The project asks for a minimal test case when a CSS property is missing or incomplete. Open an issue only after reducing the page, and include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Minimal HTML and CSS that still fails.
  2. Exact html2canvas release and the build used.
  3. Browser/version and operating system.
  4. Element dimensions, radius values, and relevant options.
  5. Expected browser appearance and the actual canvas output.
  6. Console output and whether foreignObjectRendering changes the result.

Link the reproduction rather than attaching an entire application. The shadow-related issue report illustrates why separating observed artifacts from confirmed causes is important. Consult the changelog before deciding that a release change is unrelated.

Or skip the browser setup

If your goal is a reliable website image rather than debugging a client-side canvas, ScreenshotNeo makes one server request and returns PNG, JPEG, WebP, or PDF. It accepts the cookie or consent banner like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are free, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.

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)
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}`);

See the ScreenshotNeo API documentation for parameters. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients, plus full-page lazy-image loading, CSS-selector element capture, dark mode, device presets, retina scale, custom CSS/JavaScript, click-before-capture, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; Growth is $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is included on every plan. Sign up free for 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and reliability considerations

For html2canvas, rendering a smaller element is usually a more useful diagnostic than capturing the entire document: it reduces layout, image, and font variables. Capture after asynchronous content has settled, and avoid changing styles during the call. Compare identical viewport and device-pixel settings when evaluating two renders.

For a service capture, use an explicit timeout in your client, cache only when the page can tolerate stale output, and inspect the verdict and billing headers. A failed load should be handled as an operational result rather than mistaken for a valid image. Keep API keys server-side; do not expose them in public browser code.

Best Value
Sale
JavaScript and jQuery: Interactive Front-End Web Development
  • JavaScript Jquery
  • Introduces core programming concepts in JavaScript and jQuery
  • Uses clear descriptions, inspiring examples, and easy-to-follow diagrams

FAQ

Is border-radius unsupported in html2canvas?

No. It is listed as supported, but support is property-by-property and combinations can still differ from browser pixels.

Will upgrading html2canvas definitely fix square corners?

No. Changelog fixes make the version worth checking, but the project does not promise a universal resolution for every radius interaction.

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

Should I always enable foreignObjectRendering?

No. It is an optional comparison path whose result depends on browser support and the page. Test it against the same reduced reproduction.

Does the black-border issue prove shadows cause rectangular corners?

No. The reported case links a shadow to a dark border artifact. It does not establish the cause of all square-corner outputs.

What information should accompany a bug report?

Provide the smallest failing HTML/CSS, exact release, browser and operating system, options, console output, expected appearance, and actual canvas.

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$15.73
SaleBestseller No. 2
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05
SaleBestseller No. 3
SaleBestseller No. 5
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript Jquery; Introduces core programming concepts in JavaScript and jQuery; Uses clear descriptions, inspiring examples, and easy-to-follow diagrams
$24.90

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.

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