VS Code

How to Preview Markdown in VSCode Instantly

How to Preview Markdown in VSCode Instantly

You don’t need an extension to preview Markdown in VSCode. Open a .md file, press Ctrl+Shift+V (Shift+Cmd+V on macOS), and the built-in Markdown preview renders it as formatted text. Ctrl+K V (Cmd+K V) puts the preview beside the source instead, and that one updates as you type.

I mostly use it to check a README before committing. Broken tables and a missing closing backtick show up right away.

One thing changed this year. Since VS Code 1.121 (May 20, 2026), the same preview draws Mermaid diagrams natively. A lot of older guides still say you need Markdown Preview Enhanced or a similar extension for that.

How Do You Open the Markdown Preview in VSCode?

YouTube player

The shortcut is Ctrl+Shift+V (Shift+Cmd+V on macOS), and it flips the editor between source and preview. Nothing to install.

Plenty of tutorials still start with an extension. You can skip that step.

  1. Open a .md file in the editor.
  2. Press Ctrl+Shift+V (Shift+Cmd+V on macOS).
  3. Or right-click the editor tab and select Open Preview.
  4. Or open the Command Palette (Ctrl+Shift+P) and run Markdown: Open Preview.
  5. For both panes at once, press Ctrl+K V (Cmd+K V on macOS) to open the preview beside the file.

The side-by-side version updates live while you edit. By default it also follows you around, switching to whichever Markdown file is active.

To check it works, paste in a table and a fenced code block and see if both render. If you forget the table syntax (everyone does), a Markdown cheat sheet has it.

Full-Tab, Side-by-Side or Locked: Which Preview Layout Fits?

Most of the time I keep the preview side by side. Full tab is better for a last proofread. Locking is the odd one out, since it pins a preview to one file so you can read it while editing a different one.

LayoutHow to open itBest for
Full tabCtrl+Shift+V or Markdown: Open PreviewProofreading a finished file
Side by sideCtrl+K V or Markdown: Open Preview to the SideWriting with live feedback
LockedMarkdown: Toggle Preview LockingReference file open while editing another

Locking ties the preview to its current document, and a locked preview shows [Preview] in its title. The catch is that the command only shows up when the preview itself is the active tab. Click into the preview first, then run it from the Command Palette.

Full tab gives wide tables and diagrams the whole window. You can’t see the source, though, so every typo means flipping back.

Side by side lets you watch each edit render as you type. Both panes share the window, and a wide table gets cramped fast.

A locked preview stays on one document while you jump between files. I find it handy for keeping a spec open while writing a README. It won’t follow the active file, which is annoying right up until you remember that’s the entire point of locking it.

How Does Scroll Sync Work in the Markdown Preview?

Out of the box, sync runs in both directions. Scroll the source and the preview follows. Scroll the preview and the source moves to match. Both settings default to true in the extension manifest (VS Code source, main branch, as of November 2026).

Two related helpers ship turned off. Once you enable the selection marker, the line selected in the editor appears as a light gray bar in the preview’s left margin. The other one is double-click navigation, which opens the editor and scrolls to the nearest line when you double-click an element in the preview.

Each sync direction has its own setting, markdown.preview.scrollPreviewWithEditor and markdown.preview.scrollEditorWithPreview, so you can turn them off separately.

Every shortcut and workflow trick from this guide - including Ctrl+P for quick open, Ctrl+Shift+P for the command palette, and the full grid of keyboard shortcuts - is on one page in the VS Code Workflow Cheat Sheet.

{
"markdown.preview.scrollPreviewWithEditor": false,
"markdown.preview.scrollEditorWithPreview": false

}

Honestly, I’d only turn off the second one. The preview keeps following your edits, and the editor stops jumping around while you read.

If the gray bar never shows up or double-click does nothing, that’s just the default. Set markdown.preview.markEditorSelection and markdown.preview.doubleClickToSwitchToEditor to true in the Settings UI.

Changing Preview Fonts and Styles with markdown.styles

Preview typography sits under the markdown.preview.* settings. Custom CSS goes through markdown.styles. Search “markdown.preview” in the Settings UI and you get every option in one list.

Typography settings

The preview starts at a 14 font size with a 1.6 line height (VS Code source, main branch, as of November 2026).

SettingDefaultControls
markdown.preview.fontFamilySystem UI font stackTypeface of the preview text
markdown.preview.fontSize14Text size in the preview
markdown.preview.lineHeight1.6Spacing between lines

These only touch the preview pane. Your editor font stays where it is.

▶ VS CODE PRODUCTIVITY

If you spend a lot of time in VS Code, chances are you are doing some things the slow way. These 10 built-in features eliminate repetitive clicking, scrolling, and retyping - no extensions required.

VS Code Tips That Save You Hours

Custom CSS with markdown.styles

markdown.styles takes a list of stylesheets to load in the preview. Entries can be https URLs or relative paths to local files in the workspace, and the list is empty by default.

{
"markdown.styles": ["Style.css"]
}

Never edited the file before? Here’s how to go about opening settings.json in VSCode.

Keep overrides small. Restyling headings and code blocks is usually all anyone needs.

Rendering toggles

  • markdown.preview.breaks (default false) turns newlines inside paragraphs into line breaks when set to true
  • markdown.preview.linkify (default true) converts URL-like text into links
  • markdown.preview.typographer (default false) handles smart quotes and other language-neutral replacements

If you write one sentence per line, switch breaks on. Otherwise the preview glues those lines back into a single paragraph.

What the Built-in Preview Renders, Including Mermaid and Math

Under the hood, VS Code uses the markdown-it library and targets the CommonMark specification. Its documentation answers “No” when asked whether it supports GitHub Flavored Markdown.

So a README can look a little different on GitHub than it does in the preview. Anything GitHub-specific, check on GitHub.

Mermaid diagrams

Since VS Code 1.121, released May 20, 2026, Mermaid renders in the preview with no extension. That release added a built-in extension called Mermaid Markdown Features, which draws Mermaid in the Markdown preview, in notebook Markdown cells and in chats.

According to Visual Studio Magazine, that built-in extension is Matt Bierner’s Markdown Preview Mermaid Support, merged into VS Code.

The older guides weren’t wrong, just dated. Before 1.121 you really did need something like Markdown Preview Enhanced. On an earlier build, update VS Code or install Bierner’s extension.

Write the diagram in a fenced block tagged mermaid:

graph TD; A –> B; A –> C;

To pan, hold Alt (Option on macOS) and drag. Alt plus scroll zooms. If you need the Mermaid code back out, there’s a Copy Diagram Source option in the context menu.

Math with KaTeX

The documentation says the built-in preview renders math equations using KaTeX. Wrap an inline formula in single dollar signs, like $E = mc^2$, and use double dollar signs for a block.

If prices or shell variables in your docs keep turning into equations, set markdown.math.enabled to false.

YAML front matter

By default the preview now shows front matter as a table at the top, instead of hiding the preamble (VS Code 1.121 release notes, May 2026).

The markdown.preview.frontMatter setting controls this. table is the default. Pick codeBlock to show it as a YAML code block, or hide to remove it from the preview.

Jekyll and Hugo posts start with front matter, and there the table is genuinely useful for checking titles and dates. In a README it’s clutter, so hide it.

Do You Need a Markdown Preview Extension?

Not for previewing. The built-in one handles that. Extensions are worth it when you need to export something, like a PDF or a slide deck, or when you want the preview to look like GitHub.

ExtensionAddsOwn preview?Needs
Markdown Preview EnhancedPDF and ebook export, Pandoc, slidesYesLocal tools for exports
Markdown All in OneShortcuts, table of contents, list and table formattingNoNothing extra
Markdown PDFPDF, HTML, PNG and JPEG exportNoChromium-based browser
Markdown Preview Github StylingGitHub themesRestyles the built-in oneNothing extra

Marketplace listings show about 14.8 million installs for Markdown All in One and about 10.7 million for Markdown Preview Enhanced (November 2026). Only one of those two ships its own preview.

Looking at other tooling for the editor too? This roundup of VS Code extensions is a reasonable place to start.

Markdown Preview Enhanced

This is the heavy one. You get PDF and ebook export, Pandoc integration and a presentation writer, along with Mermaid, PlantUML and WebSequenceDiagrams diagrams. Scroll sync is automatic, and math works with KaTeX or MathJax.

It has costs. The preview doesn’t open on its own, so you trigger it every time. Pandoc, ebook and PDF export rely on locally installed tools, and PlantUML needs your own server or a local .jar file unless you configure kroki.io.

Its listing also uses the same default keys as the built-in preview (Ctrl+K V and Ctrl+Shift+V). After installing, check which preview actually opens.

Markdown All in One

People install this for previewing and then find out it isn’t a preview extension. Its own listing says VS Code has basic Markdown support out of the box and points users to the built-in preview.

Where it helps is editing. Keyboard shortcuts for bold and italic, list editing, table formatting, and a table of contents updated on save by default. I’d keep it around for the table formatting alone.

There is a setting that shows the preview when a file opens. It’s off by default, so until you turn it on the extension does nothing for your preview.

Markdown PDF

Pick this when the goal is a file, not a screen. It converts Markdown to PDF, HTML, PNG or JPEG. Open the Command Palette, type “export” and choose a format.

PDF, PNG and JPEG export need a Chromium-based browser. Raw style, script and iframe elements are removed by default. Also by default, Mermaid loads from a CDN (unpkg) while PlantUML renders on the public plantuml.com server, unless you point those settings at local copies.

The Mermaid dependency is the one that bites. Offline machines render nothing until the Mermaid setting points to a local copy of the library.

Markdown Preview Github Styling

It restyles the built-in preview to look like GitHub, with light and dark themes plus dark dimmed, high contrast and colorblind-accessible variants.

Appearance only, though. It doesn’t add GitHub features such as emoji shortcodes or task lists. Put that next to the CommonMark target from earlier and you end up with a preview that looks like GitHub but still parses like CommonMark.

I’d add Markdown PDF or Markdown Preview Enhanced only when you have to hand someone a file. For writing and checking, the built-in preview is enough.

Why the Markdown Preview Fails, Blocks Content or Stops Updating

Usually it’s something boring, like a file saved with the wrong extension or a preview someone locked and forgot about. Security blocks, bad paths and old VS Code builds account for most of the rest.

SymptomLikely causeFix
Raw text instead of formattingFile saved as .txt, not .md or .markdownRename the file
Preview shows a different filePreview is lockedRun Markdown: Toggle Preview Locking again
Images missinghttp image URL blocked under StrictSwitch the URL to https
Custom CSS ignoredWrong path in markdown.stylesFix the path, reload the window
Mermaid shows as plain codeVS Code older than 1.121Update VS Code

Preview security levels

VS Code restricts what the preview displays for security reasons. To change the level, run Markdown: Change preview security settings. Whatever you choose applies to all files in the workspace.

Strict is the default. It loads only trusted content, disables script execution and blocks http images. Allow insecure content keeps scripts disabled but lets http content through, and Disable allows script execution and http content both.

Leave it on Strict. When an image is blocked, fix the image URL instead of loosening the level.

Raw text, wrong file, conflicting extensions

A preview showing raw text usually means the file extension isn’t .md or .markdown. Check for .txt first.

If the extension is right, disable other Markdown extensions one at a time. Restart VS Code after turning off the conflicting ones. That clears most remaining cases.

And a preview showing the wrong document is almost always a locked one.

Images or styles not loading

  1. Check the image URL scheme. Under Strict, only https loads.
  2. Confirm relative image paths point to files that exist.
  3. Open markdown.styles and confirm each stylesheet path resolves inside the workspace.
  4. Reload the window after changing the styles setting.

If all four checks pass, the cause is usually an extension rewriting the preview.

Markdown Preview in VSCode FAQ

What is the Markdown preview in VSCode?

It ships inside VS Code’s Markdown Language Features extension and renders a Markdown file as formatted text, either beside the source or in its own tab. That same extension holds the link validation setting, markdown.validate.enabled, which is off by default.

Can you preview Markdown in vscode.dev?

Yes. When the VS Code team announced vscode.dev in October 2021, they listed Markdown preview among the experiences nearly identical to desktop. Opening local files in the browser needs the File System Access API, which Chrome and Edge support.

Can you change the Markdown preview shortcut?

Yes. Open the Keyboard Shortcuts editor (Ctrl+K Ctrl+S) and search for the command name, such as markdown.showPreviewToSide.

The extension manifest lists no default key for Markdown: Toggle Preview Locking. If you lock previews often, give it one.

Can you edit directly inside the Markdown preview?

Not in the preview itself, which only renders. With markdown.preview.doubleClickToSwitchToEditor turned on, double-clicking an element at least opens the editor at the nearest line.

VS Code 1.144 (October 28, 2026) introduced a separate Markdown Editor for editing rendered text, and the documentation labels it experimental. Open it by picking Markdown Editor from the editor type dropdown in the breadcrumbs bar, or with View: Reopen Editor With…. It toggles between a locked, read-only rendered mode and an editing mode. Choosing Text Editor takes you back to the raw source.

Does the Markdown preview open automatically for .md files?

No. A .md file opens as source text, and you open the preview yourself with Ctrl+Shift+V or Ctrl+K V.

Some extensions change that by opening .md files straight into preview mode and hiding the source.

Which Markdown Preview Settings Belong in the Workspace?

Rendering rules the whole team should see go in the workspace. Reading preferences go in user settings. The Markdown preview then looks the same on every teammate’s machine, and each person still keeps a personal font size.

In practice that means committing markdown.styles and markdown.preview.breaks to .vscode/settings.json, while font size, font family and scroll sync stay in user settings. Open a fresh window afterward and make sure it looks right.

Workspace settings override user settings, and a committed settings file is shared with every user of the project (VS Code documentation, November 2026).

There’s a catch with the styles setting. Array values are replaced, not merged, by the higher-precedence scope, and markdown.styles is an array. A workspace list wipes out any personal stylesheets from user settings inside that project.

So the team gets consistent rendering, and you lose your own CSS in that repository. For most teams that’s a fair trade.

The guide to VSCode settings covers the remaining scopes.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.