You can build a website in Visual Studio Code by creating a project folder, opening it in VS Code, writing HTML, CSS, and JavaScript files, previewing them in a browser with the Live Preview or Live Server extension, and fixing errors using the editor's built-in tools. The only hard requirements are VS Code, a modern browser, and the free extensions described below; no framework is necessary for a first site. The steps that follow assume you're starting from nothing and want a working multi-page site you can later publish, and they apply to VS Code version 1.9x on Windows, macOS, or Linux as of late 2026.

Before You Touch Any Code: Minimum Prerequisites

Four things should be in place. First, install Visual Studio Code from Microsoft's official site and confirm it launches. Second, have a current Chrome, Firefox, Edge, or Safari installed; you'll use it constantly as your preview surface. Third, create a free GitHub account if you plan to publish later, since GitHub Pages is the lowest-friction hosting route for a static site. Fourth, decide on one working folder location, such as a Projects directory in your home folder, and avoid spaces in folder names to prevent path problems with some tools.

You don't need Node.js or npm for a plain HTML/CSS site. Install Node only if a later step (a build tool, a package manager, or a framework) requires it. This matters because many tutorials start with npm create commands, which quietly add complexity that a first website doesn't need.

One VS Code concept is worth internalizing before step one: a VS Code workspace is just a folder you've opened, plus optional settings. Files on disk are the truth; VS Code only edits them. That mental model prevents the most common beginner confusion, where a file is saved in the wrong place and the browser shows a blank page.

Step 1: Create the Project Folder and Open It in VS Code

Create a new folder for the site, for example my-first-site, using your operating system's file manager or a terminal command like mkdir my-first-site. Then open VS Code and use File > Open Folder (macOS: File > Open…) to open that folder. On first launch you may see a trust prompt asking whether you trust the folder's authors. For a folder you just created yourself, choosing to trust it is appropriate; it enables features like debugging and tasks.

The Explorer panel on the left should now show your empty folder. Everything you create from here lives inside it. If you instead open a single file rather than a folder, VS Code's relative-path features, search, and source control integration behave less predictably, so get into the habit of opening folders, not files.

Success check: the Explorer sidebar header shows your folder name, and the title bar reflects it. If the Explorer is hidden, press Ctrl+Shift+E (Cmd+Shift+E on macOS).

Step 2: Add the Extension That Does the Heavy Lifting

Open the Extensions view with Ctrl+Shift+X (Cmd+Shift+X). Two extensions dominate this workflow:

Live Preview (published by Microsoft) opens an embedded browser inside VS Code and refreshes as you edit. It's the simplest option and requires no configuration. Live Server (published by Ritwick Dey) launches your default browser at a local address like and reloads on save. It's the long-standing community favorite and works well when you want a real browser window alongside the editor.

Install one, not both, to avoid confusion about which server is serving which file. I recommend Live Server for a first project because seeing your site in a full browser window matches how visitors will experience it. Optionally add Prettier for automatic formatting and HTML CSS Support for class-name autocompletion, but neither is required for the site to work.

Success check: the extension appears in the Extensions view with an uninstall button and no error badge, and a "Go Live" button appears in VS Code's status bar at the bottom.

Step 3: Write the HTML Skeleton and Understand Each Part

Create a file named exactly index.html in the root of your folder. The name matters: browsers and most hosts serve index.html by default when someone visits your site's address without a specific filename. You can create it from the Explorer's New File icon or with the terminal command touch index.html on macOS/Linux.

Type ! and press Tab in an empty HTML file. VS Code's built-in Emmet support expands this into a full HTML5 boilerplate. The result should look like this:

Each piece earns its place. tells the browser to use standards mode. The lang attribute helps screen readers and search engines. The charset declaration prevents garbled characters. The viewport meta tag is what makes the page render at a sensible scale on phones instead of zoomed-out desktop layout. The is what appears in the browser tab and in search results.

Now fill the body with real structure:

The header/main/footer trio isn't decorative; it gives you semantic landmarks that assistive technology can navigate and that CSS can target cleanly.

Success check: save the file (Ctrl+S or Cmd+S). The tab title loses its unsaved dot. Start Live Server now and the browser should show the heading and paragraph as plain formatted text with working-looking links (the About link will fail until you create that page).

Step 4: Preview With Live Reload and Read the Developer Console

With Live Server installed, click "Go Live" in the status bar. Your default browser opens to a local address. Edit the text, save, and watch the page refresh automatically. That save-triggered reload is the core feedback loop of web development, and it's why the extension matters more than it first appears.

Open the browser's developer tools with F12 (or Cmd+Option+I on macOS). Two tabs will become your constant companions. Console shows JavaScript errors and messages; a red error there often explains a feature that silently isn't working. Elements lets you inspect any element's computed styles, which is the fastest way to answer "why is this box the wrong size?"

A common first failure: the browser shows a directory listing or a "cannot GET" message. That almost always means Live Server was started from a parent folder, so index.html isn't at the served root. Stop the server (click the status bar again), use File > Open Folder to open the exact site folder, and start it again.

Step 5: Add a Stylesheet and Link It Correctly

Create styles.css in the same folder. In index.html, inside , add:

The href is a relative path resolved from the HTML file's location. Because both files sit in the same folder, the bare filename works. If you later move CSS into a css subfolder, the path becomes css/styles.css, and forgetting that adjustment is a classic cause of "my styles aren't loading."

A minimal, sane starting stylesheet:

box-sizing: border-box makes padding count inside declared widths, which removes a whole category of layout surprise. The system-ui font stack uses whatever the visitor's operating system already has, so it loads instantly and looks native on each platform. The max-width plus margin: 0 auto pattern centers a readable column, which is most of responsive design for text-heavy pages.

Verify the link worked by checking the developer tools' Network or Sources panel: styles.css should return a 200 status, not 404. A 404 there means the path is wrong.

Step 6: Add Interactivity With a JavaScript File

Create app.js and reference it just before :

Placing the script at the end of the body means the HTML above it already exists when the script runs, so you don't need a DOMContentLoaded wrapper for simple code. A first useful script is a mobile navigation toggle or a live clock; here's something small but real:

If the year doesn't appear, open the console. Uncaught TypeError: Cannot read properties of null means the selector matched nothing, usually because the script ran before the element existed (move the script tag) or the selector text doesn't match the markup.

VS Code's built-in JavaScript support gives you IntelliSense completions and inline error squiggles without any extension. Hovering a squiggle explains the problem, and Ctrl+. (Cmd+. on macOS) offers a quick fix, which is often faster than searching.

Step 7: Build Out Multiple Pages and Shared Assets

Duplicate the structure for about.html, changing the title and main content, and keep the navigation identical across pages. For a third page, you're already repeating yourself, and that's the right moment to notice a maintenance cost rather than to install a framework. Two honest options exist.

The simple option: keep copying the header/footer markup and accept the duplication for a handful of pages. For five or fewer pages that rarely updated, this is genuinely fine.

The scalable option: when you have Node.js installed, an include mechanism or a static site generator (Eleventy and Astro are common choices) lets you define the header once. That adds a build step: you edit source files and run a build command to produce the site folder you deploy. Don't take this on until duplication actually hurts; it's a real complexity trade, not a strict upgrade.

Create an images subfolder and reference assets with paths like images/logo.png. Keep filenames lowercase and hyphenated. Case sensitivity differs between your local machine and many web servers, so a reference to Images/Logo.PNG can work locally and 404 in production.

VS Code's global search (Ctrl+Shift+F) is the practical tool for renaming a page or asset across all files, which beats editing each page by hand.

Step 8: A Five-Minute Quality Pass Before Publishing

Before any site goes live, run the same short checklist.

Validate the HTML. The W3C Markup Validation Service accepts a file upload or a URL and flags unclosed tags and duplicate IDs. Duplicate IDs break label-to-input associations and in-page links.

Check the basics in the browser. Resize the window to phone width and confirm text doesn't overflow and navigation remains usable. Press Tab repeatedly and confirm focus visibly moves through links in a logical order.

Confirm every link and asset resolves. The developer tools' Network panel will show 404s for broken images, stylesheets, or scripts in red.

Add sensible metadata. A unique per page and a are the minimum. Use relative paths for internal links and assets so the site works whether served from a domain root or a subfolder.

Tidy the code. Run Prettier if installed; consistent indentation makes future diffs readable. VS Code's Problems panel (Ctrl+Shift+M) aggregates errors and warnings from all extensions in one place.

Step 9: Publish the Static Site

A folder of HTML, CSS, and JavaScript is all a static host needs; there's no server-side runtime to configure. GitHub Pages is the most direct free option: create a repository, push your folder's contents to it, and enable Pages in the repository settings, choosing the branch and folder that hold index.html. The site then appears at a github.io address. Because your files are already being edited locally in VS Code, the editor's Source Control panel (Ctrl+Shift+G) can stage, commit, and push without a separate Git client; installing Git is a prerequisite for that panel to function.

Netlify and Cloudflare Pages follow a similar model with drag-and-drop or repository-based deploys and give you a staging URL per deploy. Whichever you choose, verify the live URL in a private browser window rather than your logged-in one, since cached assets can mask a broken deployment. Watch the Network panel on the live site for 404s, exactly as you did locally.

When Something Breaks: Symptom, Cause, Fix

Troubleshooting is faster when you map a symptom to a likely cause rather than changing things at random.

Symptom Most likely cause Reversible first check
Blank white page index.html not at the served root, or a JavaScript error halting render Check the address bar path and console
Styles absent Wrong href path, or the stylesheet file wasn't saved Network panel for a 404 on the CSS file
Script does nothing Selector mismatch or script ran before the element existed Console error text; move script tag
Layout breaks on phones Missing viewport meta tag Inspect for the viewport line
Images missing live but fine locally Filename case mismatch Compare exact filename casing character by character

Start with the reversible checks: stop and restart the preview server, re-save the file, confirm the folder opened in VS Code is the one being served. Only after those fail should you change code. The one firm stop condition is publishing: if your site must collect payments or handle personal data and you're unsure about secure handling, get a developer or the hosting provider's documentation involved before going live. Getting HTML and CSS right on your own is very achievable; getting security right on your own is not a reasonable first-project goal.