Codepen

How to become a codepen ninja.

Revisiting one of my favorite web tools in 2025. Codepen 2.0!

Codepen 2.0

Preview Controls

Since Pens can now have more than one page, use the address bar to can navigate directly to different files and see which page you're viewing. We automatically update the URL when you click links in the Pen, and you can jump back and forward in history using the arrows.

The ... menu has options for opening the Console and controlling other Preview options.

Blocks & Builds

How does your code get from the Editors to the Preview? With our lightning-fast CodePen Compiler, powered by Blocks!

Blocks are fully contained code processors, like TypeScript, Sass, Markdown, and others. Mix-and-match as many Blocks as you like! Our super-smart Compiler makes sure everything works together.

Blocks can be added manually or the Compiler will automatically add Blocks based on files to get everything ready for lightning-fast preview. Files like (.ts, .sass, and .md) are processed by the applicable Blocks then show up in the Preview.

The Build Status shows the the real-time build process. Any warnings or errors along the way are shown here or in the footer. Clicking them will take you into the file that's reporting a problem.


New for 2020

Fork before you tinker

The cardinal sin in Codepen is to start modifying something you worked hard on building. When it breaks you'll have to work to get it back. There is no undo button in Codepen! Is there? Trust me when I tell you with iterations, you always want to have the option to revert back to your original! Before you begin playing with an existing, pen, fork it!

Codepen Rockstars

Codepen Templates

https://codepen.io/pen?template=CODEPENID

Pen Templates - CodePen Blog

And here's a template I created for you:

Sample Template

Codepen API

Chris pointed me to this page after I asked him about the old school Codepen Bookmarket that is no longer available:

POST to Prefill Editors - CodePen Blog

Tutorials

Reading

Linking directly to CSS, JS, or HTML code

How do you link directly to a JS file in Codepen?

This feature was removed as shown in the screenshot (kept for historical purposes), but you can still achieve the result by adding a .html, .css, or .js at the end of your URL. Examples:

https://codepen.io/pubwriter/pen/bcac593defada781a1e34fd84499bc45.html

https://codepen.io/pubwriter/pen/bcac593defada781a1e34fd84499bc45.css

https://codepen.io/pubwriter/pen/bcac593defada781a1e34fd84499bc45.js

How to link directly to a JS file in Codepen

CodePen Topics

Codepen Topics


CodePen Walkthroughs

The best way to to learn a new tool is to watch someone use it!

Here are some users on CodePen you can shadow while they work in Codepen:

Building off Codepen

Description of project:

Rather than use a bloated CMS like wordpress/drupal/joomal etc, use a Google Sheet!

The result is a fast, responsive static site that you edit in Google Sheets!

Example:

Any URL's added here will be added as

More Reading...

Getting Started - 5 Pens to Fork

Code Penners to Follow