Download this extension from the Visual Studio Marketplace or get the latest CI build from Open VSIX Gallery.
Turn the current editor selection into a polished PNG screenshot without leaving Visual Studio.
CodeShot captures exactly what you selected and lets you copy or save it as an image in seconds.
Select code in the editor and open CodeShot. The preview follows your selection and keeps syntax coloring when available, and the toolbar Refresh button pulls it in again at any time. The common leading indentation is removed automatically, so a deeply nested selection is captured without the extra whitespace on the left.
Everything lives on the tool window toolbar:
- Pick any monospaced font installed on your machine from the font drop-down.
- Pick a font size, or type your own.
- Under the Options gear: show or hide line numbers, and show or hide the title bar. Line numbers always start at 1, so the snippet reads as a standalone sample instead of exposing where it came from in the file.
- Colors follow the Visual Studio editor theme automatically.
All of these settings are remembered between sessions and can also be edited in Tools > Options > CodeShot > General, which is what the gear button opens. Leave the font family empty or the font size at 0 to follow the Text Editor font.
Then export with one click:
- Copy Image to send the PNG straight to the clipboard.
- Save Image As to write a
.pngfile to disk.
CodeShot integrates as a standard extension command:
- Tools > CodeShot
- Ctrl+Shift+P from anywhere in the IDE
The tool window blends with the active Visual Studio theme and is designed for a fast capture workflow while you code.
- Install the extension from the Visual Studio Marketplace.
- Open a code file and select the lines you want to capture.
- Open CodeShot from the Tools menu or press Ctrl+Shift+P.
- Click Copy Image or Save Image As on the toolbar.
CodeShot was inspired by the excellent CodeSnap extension.
Found a bug or have an idea? Open an issue or pull request on the GitHub repo.

