Skip to content

Developer Guide

Convert Markdown to HTML in VS Code

Convert Markdown to HTML in VS Code using the built-in preview to render the file and an extension to export the HTML. Press Ctrl/Cmd+Shift+V to open the preview. This workflow suits developers already editing Markdown files.

Key facts

Built-in feature
live Markdown preview only
Preview shortcut
Ctrl/Cmd+Shift+V
HTML export
requires an extension
Best for
an in-editor editing workflow

How do you preview Markdown as HTML in VS Code?

Open a .md file and press Ctrl+Shift+V, or Cmd+Shift+V on macOS. VS Code opens a live preview that renders the Markdown as HTML and updates as you type. The preview is built in and needs no extension.

Use Ctrl/Cmd+K V to open the preview beside the editor instead of replacing it. For the methods overview across languages and tools, see How to Convert Markdown to HTML.

How do you export HTML from VS Code?

VS Code has no built-in HTML export — the preview renders HTML but cannot save it. Install an extension such as Markdown All in One or Markdown Preview Enhanced, then run its export command to write an HTML file.

This is the key limitation of the editor method: rendering is built in, but producing an HTML file always needs an extension.

How do you save the rendered HTML?

Use the export command of your chosen extension. Markdown All in One adds a Print current document to HTML command, and Markdown Preview Enhanced offers an HTML export from the preview's right-click menu.

Open the command palette with Ctrl/Cmd+Shift+P and search for the extension's HTML command to run it.

When should you use the editor method?

Use VS Code when you are already editing Markdown there and want a quick local render. For automated or repeated conversions, a library or the Pandoc command line is a better fit than a manual editor workflow.

For the command-line approach, see Convert Markdown to HTML with Pandoc; for a scripting approach, see Convert Markdown to HTML in JavaScript.

Frequently Asked Questions

Does VS Code export HTML without an extension?
No. The built-in Markdown preview renders HTML but cannot save it to a file. Exporting an HTML file always requires an extension such as Markdown All in One or Markdown Preview Enhanced.
Which extension should I install for HTML export?
Markdown All in One and Markdown Preview Enhanced are the two common choices. Both add an export-to-HTML command. Markdown All in One also adds shortcuts and a table of contents; Preview Enhanced adds richer rendering.
Does the VS Code preview render GitHub Flavored Markdown?
Yes. The built-in preview renders GitHub Flavored Markdown features such as tables, task lists, and fenced code blocks, so the preview closely matches how the file appears on GitHub.
Should I use VS Code or an online converter?
Use VS Code when you are already editing the file there. Use an online converter for a quick one-off conversion with no setup. The online tool needs no extension and runs entirely in the browser.