Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11To turn code into a website preview image, first render it as a webpage, then capture the browser output. For a quick one-off image, open the page in a browser and take a screenshot. For repeatable captures, use Playwright to save a viewport, full-page, or element screenshot to a file. Source code itself is not a website screenshot: the browser must run or display the code before there is anything to capture.
Choose the right way to preview your code
The best workflow depends on whether you need a single image or expect to generate it again. A manual browser capture has little setup and works well for checking a page or sharing a quick preview. Playwright adds setup, but lets you control the viewport, capture scope, and output through repeatable commands or code.
| Workflow | Best for | Trade-off |
|---|---|---|
| Browser or VS Code preview | A quick visual check or one-off image | Fast to start, but capturing the same state again depends on repeating the browser steps. |
| Playwright CLI | A quick scripted capture without writing an application | Repeatable command-line workflow, with fewer opportunities for custom logic than using the API. |
| Playwright API | Repeated captures, build workflows, or visual review | More control, but requires a small script and a working Playwright browser installation. |
VS Code’s integrated browser can preview a web application, and its Live Preview extension can use that browser to preview web pages. If your project already runs locally, you can open its development URL in a browser instead; for a framework-based project, follow that project’s own run instructions. There is no single development-server command that applies to every framework.
Render the page before taking a screenshot
For a small static page
Open the HTML file in a browser, or serve it locally if the page depends on assets or browser features that do not work as expected from a file URL. Confirm that the layout, fonts, images, and interactions you want to show are present before capturing. If you edit the source after opening the page, reload it so the screenshot reflects the latest code.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
For a framework or development project
Start the project using its documented development command and open the local URL it prints. Check that the page loads at that address before launching a capture. The port and URL vary by project, so replace example addresses in commands and scripts below with the URL your development server actually uses.
A local URL such as http://localhost:3000 works when Playwright runs on the same machine as the development server. A remote screenshot service generally cannot reach your computer’s localhost address; use a publicly reachable page URL instead.
Decide what the image should include
- Viewport: captures the portion currently visible in the browser. Choose it for a screen-sized preview, a particular scroll position, or a page state such as an open menu.
- Full page: captures the whole scrollable page. Choose it for a long landing page or document when the full layout matters.
- Element: captures one targeted component, such as a card, form, or section. Choose it when the surrounding page would add clutter.
These are different capture goals, not different image formats. In Playwright, full-page capture is an option for a page screenshot; the CLI reference does not allow combining full-page capture with a target element. For a specific element, use a locator or target element screenshot instead.
Take a one-off screenshot in the browser
- Open the rendered page in a browser or VS Code’s integrated browser.
- Set the browser window to the size and scroll position you want represented.
- Use the browser’s screenshot or capture feature, if available, or your operating system’s screenshot shortcut.
- Save the image and inspect it at full size. If the result cuts off content, decide whether you need a full-page capture or a different scroll position.
This is usually the shortest path for a single preview. It is less suitable when you need many images, consistent dimensions, or repeated captures as the code changes.
Automate a screenshot with Playwright
Install Playwright
In a JavaScript project, install Playwright and its browser binaries before running the script:
- Run
npm install -D playwrightin the project directory. - Run
npx playwright install chromiumto install Chromium for Playwright. - Start your website using the project’s normal development command and note its local URL.
These commands are for the JavaScript Playwright package and Chromium. If you use another Playwright language binding or browser, follow that binding’s installation instructions. Keep the development server running while you capture a local page.
Save a full-page PNG
Create screenshot.js in the project directory. Replace the example URL with the address served by your application.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
try {
const page = await browser.newPage({
viewport: { width: 1440, height: 900 }
});
await page.goto('http://localhost:3000');
await page.screenshot({ path: 'preview.png', fullPage: true });
} finally {
await browser.close();
}
})();
Run it with node screenshot.js. The script opens a browser page, navigates to the URL, writes preview.png in the current directory, and closes the browser even if capture fails. Remove fullPage: true if you want only the current viewport. The 1440-by-900 viewport is an example; choose dimensions appropriate to the design you are checking.
Recommended Free Tools
Rank #3
Capture from the command line
For a one-off automated capture, Playwright’s CLI can take a screenshot without a custom script:
npx playwright screenshot --full-page http://localhost:3000 preview.png
Replace the URL and output filename as needed. The CLI supports viewport, target-element, full-page, filename, format, and high-resolution options. Use its target-element option when you need one component rather than the whole page; do not combine an element target with full-page capture.
Capture one element with the API
Use a locator screenshot when the image should contain one component. Replace the selector with one that matches the element in your page:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto('http://localhost:3000');
await page.locator('.preview-card').screenshot({ path: 'card.png' });
} finally {
await browser.close();
}
})();
If the selector matches nothing, the capture cannot produce the intended element image. Verify the selector in the rendered page and account for elements that appear only after interaction or loading.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #4
- 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
Choose image format and resolution
Playwright supports PNG, JPEG, and WebP screenshots. PNG is a straightforward choice when crisp interface details or lossless output matter. JPEG can suit photographic output where smaller files are useful, but it does not support a transparent background. WebP supports a quality setting; Playwright documents quality 100 as lossless WebP. Choose based on the image’s purpose rather than assuming one format is always best.
Playwright’s scale setting controls whether output is one image pixel per CSS pixel (css) or uses device pixels (device). CSS scale is useful when the image should follow the page’s CSS dimensions and remain smaller. Device scale can produce a higher-resolution image and may be twice as large or more on high-DPI displays. Match scale to how the image will be displayed or compared, and inspect the resulting dimensions if the file is unexpectedly large or small.
Make repeated captures more consistent
For visual comparisons, keep the capture conditions stable: use the same viewport, browser version, operating system, settings, hardware, power conditions, and headless or headed mode as the reference capture when possible. Playwright notes that rendering can vary across these environmental factors, so a pixel difference does not automatically mean your code changed.
Dynamic content can also make otherwise identical screenshots differ. Time-sensitive labels, rotating content, animations, and delayed data may change between runs. Wait for the page state or element that matters before capturing; there is no single wait condition that is correct for every application. For visual comparison tests, Playwright also documents screenshot styles that can help filter volatile elements.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsBest Value
Troubleshoot blank, incomplete, or unexpected images
- The image is blank or shows an error: confirm that the development server is running and that the browser can load the exact URL. Check the terminal and browser output for application errors.
- Images or content are missing: the page may still be loading asynchronously. Wait for the relevant content or element before capture rather than relying on an arbitrary delay for every site.
- The bottom of the page is missing: check whether you took a viewport screenshot. Use full-page capture if the whole scrollable page is intended.
- The capture includes too much surrounding content: target the required element with a locator or CLI target option instead of capturing the whole page.
- The output looks blurry, too large, or too small: check the chosen format, viewport dimensions, and scale. CSS-pixel and device-pixel output have different size and resolution characteristics.
- The screenshot changes between runs: compare captures in a consistent environment and account for dynamic content. A different OS, browser version, hardware, or headless mode can affect rendering.
- A remote service cannot capture your local page: a service outside your machine cannot ordinarily access its
localhost. Deploy the preview or otherwise make it reachable at a URL the service can load.
Or skip the browser setup
If the page is reachable by URL, ScreenshotNeo can return a screenshot or PDF from one GET request. Its clean-shot steps accept cookie or consent banners like a visitor and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers say which page verdict and billing status applied. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, or another MCP client.
Use a publicly reachable URL in place of the example URL below. An API key is required; see the ScreenshotNeo API documentation for setup and request details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots a month with no card. Paid plans start at $5 for 3,000 screenshots; yearly billing gives two months free, and every feature is on every plan. Sign up for free and get 1,000 screenshots a month with no card.
Frequently asked questions
Can I turn a source file directly into a website screenshot?
No. The screenshot shows the browser-rendered result, so first open the HTML or run the project to render the page.
Can I capture a preview running on my computer with an API?
Only if the service can reach the page URL. A remote service generally cannot access a private localhost address on your computer.
Which capture should I use for a visual test?
Use the same scope and environment as the reference image. A viewport, full-page, and element capture are different outputs and should not be compared as though they were interchangeable.
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.

