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

The quickest way to make a clean image of selected code in Visual Studio Code is to install CodeSnap, select the lines, open the Command Palette, run CodeSnap, adjust the preview, and click the shutter to save. You can also copy the rendered image. If you need the surrounding editor, terminal, or file tree, use your operating system’s normal screen-capture tool instead.

Choose the screenshot you actually need

There are two different results people call a “VS Code screenshot.” Decide before capturing:

  • Code-only image: A focused card containing selected source, useful for documentation, lessons, posts, issues, and presentations. CodeSnap is designed for this.
  • Editor-context screenshot: The complete VS Code window or desktop, including tabs, line numbers, explorer, terminal, and other context. Use your system’s built-in capture feature; the exact shortcut varies by operating system and is not covered by CodeSnap’s listing.

For a code-only image, select a self-contained snippet with enough surrounding lines to explain it. Remove unrelated code and inspect the final image for secrets such as API keys, tokens, passwords, personal data, or proprietary source.

Method 1: Use CodeSnap for a clean code image

1. Install the extension

  1. Open the Extensions view in VS Code: Ctrl+Shift+X on Windows or Linux, or ⇧⌘X on macOS.
  2. Search for CodeSnap.
  3. Check the publisher and listing details, then select Install. VS Code can show a third-party publisher trust prompt the first time you install an extension; review it before proceeding.

Extensions are managed from the Marketplace and can later be configured, disabled, updated, or removed from the same view. Marketplace information such as publisher, compatibility, install count, rating, dependencies, and update history can change, so verify the live listing when choosing between similar extensions.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

2. Select the code

Drag across the lines in the editor, or use keyboard selection. Include imports, function signatures, or output that a reader needs to understand the fragment, but avoid making the image so tall that the text becomes unreadable when displayed.

3. Open CodeSnap

With the selection active, use either route:

  • Open the Command Palette with Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS, then search for CodeSnap.
  • Right-click the selected code and choose the CodeSnap command from the context menu.

The extension opens a preview of the selected source rather than capturing the entire VS Code window.

4. Frame and style the preview

Adjust the preview width before exporting. CodeSnap’s documented settings include:

  • Background color, padding, shadow, and rounded corners
  • Window controls and a title
  • Regular line numbers or actual source line numbers
  • Transparent background
  • Capture target and shutter action

Choose a width that keeps long lines from wrapping unexpectedly. For slides or social posts, test the image at its final display size; syntax colors that look clear in the editor can become too small after scaling.

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

5. Save or copy the image

Click the shutter to save the image. To copy it, click the image and use the shortcut shown by CodeSnap—Ctrl+C on Windows/Linux or Cmd+C on macOS—or configure the shutter action to copy in the extension settings. Paste the result into your document, issue, presentation, or image editor and confirm that the complete selection arrived.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

CodeSnap settings that matter

Need Setting or action Practical choice
Readable long lines Preview width Increase width until important expressions do not wrap, then check the final display size.
Source references Line numbers or actual source line numbers Use actual source numbers when readers must locate the code in a file.
Minimal graphic Background, shadow, corners, padding Use restrained padding and contrast; remove decoration that competes with syntax.
Transparent placement Transparent background Useful when placing the code over a designed slide, provided contrast remains sufficient.
One-click workflow Shutter action Choose save for files or copy for immediate pasting.

Settings are extension-specific. If a control is missing, open the CodeSnap listing and its settings documentation rather than assuming another screenshot extension uses the same name.

Method 2: Capture the whole VS Code window

Use a system screenshot when context is the point: a terminal error, file path, open tabs, breakpoint, extension panel, or side-by-side diff. Arrange VS Code first:

  1. Close unrelated tabs and panels.
  2. Resize the editor so the relevant code and context are legible.
  3. Hide credentials and private files.
  4. Capture the window or selected screen region with your operating system’s screenshot utility.
  5. Crop only after checking that the evidence you need—such as a filename or error message—remains visible.

The reviewed CodeSnap documentation establishes the extension workflow, not a single universal keyboard shortcut for every operating system. Use the current shortcut and capture controls documented by your OS.

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

Alternatives in the Marketplace

CodeSnap is the documented starting point for saving or copying a selected-code image. Other listings include VSCodeSnap, described as a CodeSnap fork with additional controls, and CodeSnap Extended, which describes clicking a line number to highlight a line while retaining the original screenshot features. A fork’s historical statement about the original’s update interval is not a current maintenance guarantee.

Before installing any alternative, compare the live Marketplace listing for:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Publisher identity and trust information
  • VS Code version compatibility and dependencies
  • Latest release date and changelog
  • Output controls: save, clipboard copy, line numbers, highlighting, backgrounds, and transparency
  • Permissions, documentation quality, ratings, and current install information

Do not choose an extension solely because it appears high in search results; listing details and maintenance status change.

Or skip the browser setup

If your “code screenshot” is a web page, documentation page, online playground, or rendered HTML example, ScreenshotNeo can capture that URL through one request. It does not replace CodeSnap for unsaved local code in your VS Code editor; it is useful when the code is already published or rendered in a browser.

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

For API details and all capture options, see the ScreenshotNeo documentation. This cURL example returns a WebP image:

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

Before capture, ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and whether the request was billed. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Features include full-page screenshots with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper and margin controls, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs.

Plans are Free (1,000 shots per month, no card), Starter ($5 for 3,000), Growth ($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. Create a free ScreenshotNeo account to get 1,000 screenshots a month without a card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

CodeSnap does not appear

Confirm that the extension finished installing and that a code selection is active. Reopen the Command Palette and search for “CodeSnap”; if it is disabled, enable it from Extensions and reload VS Code when prompted.

The image is blank or incomplete

Try a smaller selection, reopen the preview, and check that the editor contains real text rather than an empty region. If only part of the code appears, verify that the selection did not end before the final line.

Copy does nothing

Click the preview first, then use the platform shortcut displayed by CodeSnap. Alternatively, set codesnap.shutterAction to copy and invoke the shutter again.

Line numbers are wrong

Enable actual source line numbers in CodeSnap’s settings when the snippet comes from the middle of a file. Plain sequential numbers are better for a standalone teaching example.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

The code is unreadable after publishing

Increase capture width, reduce the number of lines, and export again. Avoid shrinking a tall image into a narrow column; split a long example into logically connected images instead.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

An extension behaves differently after an update

Review its current Marketplace changelog and settings. Extension commands, compatibility, and defaults can change independently of VS Code itself; disable competing screenshot extensions temporarily to identify command conflicts.

Quick checklist

  • Choose code-only or full-editor context.
  • Select only the lines a reader needs.
  • Verify the publisher before installing an extension.
  • Set width, line-number style, background, and shutter action.
  • Save or copy, then inspect the exported image at its final size.
  • Remove secrets and private information before sharing.

FAQ

Can I screenshot code without installing an extension?

Yes. Use your operating system’s screen-capture utility to capture the VS Code window or a region. That preserves editor context but requires cropping and does not create CodeSnap’s styled code card.

Does CodeSnap capture the entire file?

The documented workflow starts with selected code. Select the complete file if you need all of it, while considering readability and image size.

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

Can ScreenshotNeo capture unsaved code in VS Code?

No. ScreenshotNeo captures a URL. Publish or render the code at an accessible URL first, or use CodeSnap for local editor content.

Frequently Asked Questions

Can I screenshot code without installing an extension?

Yes. Use your operating system’s screen-capture utility to capture the VS Code window or a region. That preserves editor context but does not create CodeSnap’s styled code card.

Does CodeSnap capture the entire file?

The documented workflow starts with selected code. Select the complete file if you need all of it, while considering readability and image size.

Can ScreenshotNeo capture unsaved code in VS Code?

No. ScreenshotNeo captures a URL. Publish or render the code at an accessible URL first, or use CodeSnap for local editor content.

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.