The CodePen extension for VS Code lets you create and edit your Pens as real files on your own machine. Start a new Pen, or pull down an existing one from the sidebar or by its URL. Edit the files however you like (in your editor, from a terminal, or with a coding agent), and every change is saved back to CodePen, built there, and shown in a live preview beside your code.

It works in VS Code and the editors built on it, such as Cursor, Devin Desktop (formerly Windsurf), and Antigravity.

A Pen open in the editor: the CodePen sidebar with the Current Pen and Your Pens, the Pen's files, and its live preview beside the code

Installing

Search for CodePen in your editor’s Extensions view and install the one published by CodePen-Official. It’s listed in two places, and your editor picks the right one for you:

Or from a terminal:

code --install-extension CodePen-Official.codepen
cursor --install-extension CodePen-Official.codepenCode language: Bash (bash)

Updates arrive automatically, just like any other extension.

Getting Started

You need a CodePen account. The extension works on Pens made in the CodePen 2.0 editor.

  1. Sign in. Open the Command Palette (Cmd+Shift+P on Mac, Ctrl+Shift+P on Windows and Linux) and run CodePen: Sign In. Your browser opens CodePen, where you sign in the way you usually do (GitHub, Google, or your password) and approve the extension. The browser then hands you back to your editor, which asks once whether the CodePen extension may handle the link. The sign-in is kept in your editor’s secure storage, not in a file, and there’s no API key to copy around.
  2. Open a Pen. Click one in the CodePen sidebar, or run CodePen: Open Pen and paste the Pen’s URL. The Pen is saved to a CodePen folder in your home directory (you can change that) and opens in this window, or in a new window if this one already has a Pen open. To start from scratch, click New Pen in the sidebar or run CodePen: Make New Pen.
  3. Edit. There’s no save-to-CodePen step: change a file, and it goes up. Watch the CodePen item in the status bar to see your changes being pushed and built.
  4. See it run. Run CodePen: Show Preview for a live preview beside your code.

To come back to a Pen later, open its folder. It stays linked to the Pen.

Opening a Pen from codepen.io

CodePen offers an Open in… menu for helping you open a Pen directly in your local editor of choice. A Pen you already have a folder for opens in that folder, and if a window already has it open, that window comes to the front. The link looks like this (with cursor:// and so on for other editors):

vscode://CodePen-Official.codepen/open?pen=<id>Code language: plaintext (plaintext)

The CodePen Sidebar

Click the CodePen icon in the activity bar to open it.

The CodePen sidebar: a New Pen button, search and sort, and a list of Pens with screenshots, descriptions and tags
  • Current Pen appears when the window has a Pen open, with its screenshot, title, description and tags. Hover the screenshot to show the preview, open the preview in your browser, or open the Pen on CodePen. Click the pencil beside the title to change the title, description and tags.
  • Your Pens lists your Pens with screenshots, newest first. Search them, sort by last updated, date created or popularity, and page through them. Click a Pen to open it, or right-click it to open it in a new window or view it on CodePen.
  • Pens of switches between your own Pens and those of any PRO Team you belong to.
  • New Pen makes a Pen (in the Team you’re browsing, if any) and opens it.

How Syncing Works

  • Every change is saved. When the folder has been quiet for a moment (750ms by default), the changes go up to CodePen as one new saved version. Creating a file adds it to the Pen; deleting a file removes it.
  • CodePen builds it. Each save is built by the Pen’s Blocks, just as in the web editor, so there’s nothing to install or run locally. If the build changes your source files (a formatter, say), those changes come back into your folder.
  • Errors show where you work. Build errors and warnings appear in the Problems panel and as underlines in the file.
  • The preview follows the build. It refreshes after every successful build and has a DevTools button for the console and inspector. The preview inside the editor needs CodePen PRO; on a Free plan, use CodePen: Open on CodePen to see your Pen run.

When the Pen changes on CodePen too

The extension checks CodePen when you open a Pen’s folder and whenever it pushes.

  • If only CodePen changed, those files are updated in your folder and you’re told.
  • If you have changes of your own as well, you’re asked what to do: Review each file side by side, Keep Mine, or Take Theirs. Nothing is overwritten without asking.

It doesn’t watch CodePen in between. If you changed the Pen on CodePen and want those changes now, run CodePen: Pull from CodePen. It makes the folder match the Pen: files are replaced with CodePen’s version, and files CodePen doesn’t have are removed. If the folder has changes that were never pushed, it lists them and asks first.

Tip: close the Pen’s tab on codepen.io while you work on it in your editor. A browser tab left open can save its older copy of your code over what you pushed. If that happens you’ll see a conflict; choose Keep Mine to put your code back.

The status bar

It showsIt means
✓ CodePenYour folder and CodePen match.
CodePen: pushingYour changes are on their way.
CodePen: buildingCodePen is building the Pen.
CodePen: pausedYou paused syncing. Changes aren’t being sent.
CodePen: conflictThe Pen changed on CodePen too. Click to choose which version to keep.
CodePen: waiting to retryCodePen couldn’t be reached, or a limit was hit. It tries again by itself.
CodePen: failedSomething needs your attention. Hover or click for the reason.

Your local files are never changed or undone because of a failure. Click the status bar item for more actions.

Which Files Are Sent to CodePen

Everything in the folder is part of the Pen, except files that only matter on your computer. These are never sent:

  • .git, node_modules, .DS_Store and similar system files
  • editor settings such as .vscode and .idea
  • files for coding agents, such as CLAUDE.md, AGENTS.md, .cursor, .devin and .claude

To keep other files out of the Pen, create a .codepenignore file in the folder and list them one pattern per line, the same way as a .gitignore:

notes/
*.logCode language: plaintext (plaintext)

The folder also holds a .codepen-sync.json file. It’s how the folder remembers which Pen it belongs to, and whether that Pen is yours or a Team’s. Leave it in place; it’s never sent to CodePen.

Team Pens

Signing in also reaches the Pens of every Team you belong to, as long as the Team is on a PRO plan. There’s nothing more to set up: pick the Team under Pens of in the sidebar, open its Pens like any other, and new Pens you make there belong to the Team. Changes you push to a Team’s Pen are yours, as they are in the web editor.

Working with AI Agents

Because the Pen is real files on disk, any coding agent can work on it: Copilot, Claude Code, Codex, Cursor’s agent, and the rest. And because CodePen builds the Pen on every save, an agent doesn’t need to build it or run a server to check its work. The extension tells agents so, in rule files of its own:

FileRead by
.cursor/rules/codepen.mdcCursor
.github/instructions/codepen.instructions.mdGitHub Copilot
.claude/rules/codepen.mdClaude Code
.windsurf/rules/codepen.mdDevin Desktop (formerly Windsurf)
.agents/rules/codepen.mdAntigravity

They tell agents to edit the files in the folder rather than change the Pen through CodePen’s API or MCP tools (which would cause a conflict), and explain how a Pen is built: Blocks switch on for the files they process, and pages link their own source files. They give the address of the Pen’s built preview, which agents can open with their browser tools, and point agents that have CodePen’s MCP tools at preview_pen for a screenshot and the console. A .codepen-status.json file says whether the last save has been pushed and built yet, and what went wrong if the build failed, so an agent knows when to look.

These files are hidden from the editor’s file list and never sent to CodePen. Your own AGENTS.md, CLAUDE.md and the like are never touched. Turn the rule files off with the codepen.agentInstructions setting.

The MCP server, built in

In VS Code 1.101 and later, the extension also gives Copilot and other agents in the editor CodePen’s MCP server, signed in as you, with no setup. It appears as CodePen (and CodePen (Team name) for each of your Teams) in the editor’s MCP server list, where it can be stopped or turned off. Cursor and older versions of VS Code don’t support this; add https://mcp.codepen.io/mcp yourself there, as the MCP docs describe.

Commands

All of these are in the Command Palette.

CommandWhat it does
CodePen: Sign In / Sign OutConnect this editor to your CodePen account, or disconnect it.
CodePen: Open PenBring one of your Pens, or your Team’s, into a folder and open it.
CodePen: Browse PensShow the CodePen sidebar.
CodePen: Make New PenMake a Pen on CodePen and open it in a folder.
CodePen: Show PreviewShow the running Pen beside your code.
CodePen: Open on CodePenOpen the Pen on codepen.io.
CodePen: Edit Pen DetailsChange the open Pen’s title, description and tags.
CodePen: Pause Sync / Resume SyncStop sending changes for a while. Resuming sends everything as one save.
CodePen: Push NowSend changes right away.
CodePen: Pull from CodePenReplace the folder with the Pen as it is on CodePen. Asks first if you have changes that would be lost.
CodePen: Resolve ConflictChoose which version to keep when the Pen changed in both places.
CodePen: Show Sync StatusShow what syncing is doing, with more actions. The same as clicking the status bar item.

Settings

SettingDefaultWhat it does
codepen.folder~/CodePenWhere opened Pens are saved.
codepen.quietWindow750How long, in milliseconds, to wait after the last change before pushing. Raise it if you want fewer saves.
codepen.agentInstructionstrueWrite the rule files for AI agents described above.

To keep your Pens somewhere other than ~/CodePen, open your editor’s Settings, search for CodePen: Folder and enter a folder such as ~/Projects/pens. Only Pens you open from then on go there. Pens you already have stay where they are and keep working, so move their folders over yourself if you want them all in one place.

Plans and Limits

The extension works on every plan. It goes through the CodePen API, so the API’s limits apply, and a Pen can hold as many files as your plan allows (3 on Free, and up to 300 on PRO). If a save is refused, the status bar says why.

PRO adds the live preview inside the editor, Team Pens, and higher limits.

Good to Know

  • Your own Pens and your Teams’ only. Being a collaborator on someone else’s Pen isn’t enough to open it.
  • 2.0 Pens only. Pens made in the classic editor can’t be opened.
  • One Pen per window.
  • Signing out elsewhere signs you out here. Disconnecting the extension under Connected apps at Settings → API, or changing your password, ends the sign-in. Syncing stops, your files stay as they are, and it picks up again when you sign in.
  • Not available yet: forking Pens, making a Pen from a folder you already have, and changing a Pen’s privacy from the extension. Do those on codepen.io.
Was this article helpful?
YesNo
Last updated: November 25, 2026