Skip to content

Starter Template

Page basics

Layout
CSS
Inline <style>
Stylesheet links (a path like /css/style.css or a full https:// address)
JavaScript
Script files
Load with

Icons

Leave a box empty to skip that icon. Need the files? Make them with the Favicon Generator.

Colors
Social sharing

Uses your title, description and site name. For X cards, alt text and more, use the Meta Tag Generator.

Scripts don't run here, and your stylesheet, script and icon files aren't loaded, because they live on your site.

Checks

  • OK Looks good. Download index.html and upload it to your site with your CSS, JavaScript and icon files. To try it on your own computer first, use relative paths like css/style.css (a path starting with / points at the top of the drive there), and serve the folder with a small local server if you use type="module" scripts.

HTML Starter Template: Make a Clean HTML5 Boilerplate

What Is an HTML Boilerplate?

An HTML boilerplate (also called a starter template) is the code every page begins with: the doctype, the <html> tag with a language, a <head> with a few important tags, and a <body> for your content. It's the same few lines each time, and it's easy to forget one, like the viewport tag that makes the page work on phones.

This generator writes the whole index.html for you. Tick what you need (title and description, favicon links, your CSS and JavaScript files, a ready-made layout), watch the preview, read the checks, then copy the code or download the file. It all runs in your browser, and your last choices are remembered for next time.

How to Use It, Step by Step

Step 1 Fill In the Page Basics

Pick the Language, type a Page title and a short Meta description. Add the Canonical URL once you know the page's address, and a Site name for the header and footer. Press Sample to see a filled-in example, or Reset for a plain page.

Step 2 Choose a Layout

Blank gives you an empty body. The others add a small skeleton built from semantic tags: header, main and footer; a version with a menu and sidebar; a centered card for sign-in or "coming soon" pages; and a landing page with a big intro, three feature cards and a call to action. The text in them is placeholder text for you to replace.

Step 3 Add Your CSS and JavaScript

Under CSS, pick a Modern reset, Minimal base styles or none, and list your stylesheet files. Under JavaScript, list your scripts and choose how they load. defer is picked for you because it's right for most scripts.

Step 4 Icons, Colors and Sharing

Switch on Favicon links and fill in the paths to your icon files. A Theme color tints the browser bar on phones, Light and dark mode lets the page follow the visitor's setting, and Open Graph tags give your link a title, text and picture when someone shares it.

Step 5 Check, Then Copy or Download

The Preview tab shows the page (scripts don't run there, and your own CSS and JS files aren't loaded, since they live on your site). The HTML code tab shows the file with line numbers. Read the Checks list, then press Copy or Download index.html. Switch off Comments if you don't want the <!-- --> notes.

💡 Everything you type is escaped, so it can't break the page. A < in your title comes out as &lt;. A quote stays a plain " inside <title>, where it's harmless, and becomes &quot; only in attribute copies like og:title.

The Minimum Valid HTML Page

This is the smallest page that's valid HTML5 and works properly on phones. You can save it as index.html and open it in any browser:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My first page</title>
</head>
<body>
  <h1>Hello, world</h1>
</body>
</html>

Here's what each line does:

Line What it does
<!doctype html> Tells the browser this is a modern HTML page. Without it, browsers fall back to "quirks mode" and copy old bugs, so sizes and spacing can come out wrong. Upper or lower case both work.
<html lang="en"> The root of the page. lang says which language the text is in, so screen readers pick the right voice and browsers can offer to translate.
<head> Information about the page that isn't shown on it: the title, meta tags, links to CSS and scripts.
<meta charset="utf-8"> The text encoding. UTF-8 covers every language and emoji. Keep it the first line in <head>.
<meta name="viewport" ...> Makes phones show the page at the real screen width instead of a zoomed-out desktop view.
<title> The name in the browser tab, in bookmarks and usually the blue link in search results. Every page needs one.
<body> Everything people see: headings, text, images, links and forms.

What to Add Next

Once a page is going to be public, a few more lines in the <head> pay off. Here's the same head with a description, a canonical link, icons, a stylesheet and a script:

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Fresh Sourdough | Example Bakery</title>
  <meta name="description" content="A small bakery making sourdough and pastries every morning.">
  <link rel="canonical" href="https://example.com/">

  <link rel="icon" href="/favicon.ico" sizes="32x32">
  <link rel="icon" href="/icon.svg" type="image/svg+xml">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  <link rel="manifest" href="/site.webmanifest">

  <link rel="stylesheet" href="/css/style.css">
  <script src="/js/main.js" defer></script>
</head>

For link previews on social apps and chats, and the full set of search tags, the Meta Tag Generator goes further, with previews of how the link will look.

A Semantic Layout Skeleton

"Semantic" means using tags that say what each part of the page is, instead of a pile of <div>s. Screen readers use these tags to jump around the page, and search engines use them to find the main content. Here's how a typical page fits together:

<body>
  <a class="skip-link" href="#main">Skip to content</a>

  <header>
    <a href="/">Example Bakery</a>
    <nav aria-label="Main">
      <ul>
        <li><a href="/">Home</a></li>
        <li><a href="/about">About</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <h1>Bread baked fresh every morning</h1>
    <p>...</p>
  </main>

  <aside>
    <h2>Opening hours</h2>
  </aside>

  <footer>
    <p>&copy; 2026 Example Bakery</p>
  </footer>
</body>
Tag Use it for
<header> The top of the page: logo or site name, often the menu.
<nav> A group of main links. Give it aria-label="Main" when there is more than one nav.
<main> The content that is unique to this page. Use exactly one, and give it the page's <h1>.
<article> Something that makes sense on its own, like a blog post or a product card.
<section> A themed part of the page with its own heading, like "Features" or "Prices".
<aside> Side content: related links, a table of contents, an author box.
<footer> The bottom of the page: copyright, contact links, small print.

The skip link at the top is for people who use the keyboard: pressing Tab once shows it, and Enter jumps straight to <main> instead of tabbing through every menu link. The generator hides it off screen until it gets focus. To look up any other tag, see the HTML Tags list.

Where to Put CSS and JavaScript, and Why

CSS goes in the <head>. The browser waits for stylesheets in the head before it draws the page, which sounds slow but is what you want: otherwise people see a flash of unstyled text first. When two rules are equally specific, the one that comes later wins. That's why the generator puts its small inline <style> (the reset and layout) first and your <link rel="stylesheet"> tags after it: your own CSS can change anything the starter styles set.

JavaScript goes in the <head> too, with defer. A plain <script src> makes the browser stop, download the file, run it, and only then carry on reading the page. With defer the file downloads while the page loads and runs once the HTML is ready, so your code can find every element and nothing is held up.

<head>
  ...
  <!-- CSS: in the head, so the page shows up already styled -->
  <link rel="stylesheet" href="/css/style.css">

  <!-- JavaScript: in the head with defer, so it doesn't hold up the page -->
  <script src="/js/main.js" defer></script>

  <!-- Or, for code that uses import and export -->
  <script type="module" src="/js/app.js"></script>
</head>
How you load it Download Runs Good for
<script src> Stops the page while it loads Right away Only scripts that must run before anything shows
<script src defer> Alongside the page After the HTML is read, in order Your own main script (the usual choice)
<script src async> Alongside the page As soon as it arrives, any order Independent scripts like analytics
<script type="module"> Alongside the page After the HTML is read, like defer Code that uses import and export

Common Mistakes

<head>
  <title>Café Menü</title>
  <style>
    /* ...1,500 bytes of CSS... */
  </style>
  <meta charset="utf-8">   <!-- too late: past the first 1024 bytes, so it can be missed -->
</head>

Not sure your page is right? Paste it into the HTML Validator: it finds missing tags and typos and explains them in plain English.

What This Tool Doesn't Do

Want to try the page and edit it live? Paste the code into the HTML Editor and add your own CSS and JavaScript next to it.

Frequently Asked Questions

What is an HTML boilerplate?

It's the starting code almost every web page shares: the <!doctype html> line, the <html lang> tag, a <head> with the charset, viewport and title, and an empty <body>. You copy it once at the start of a project instead of typing it from memory each time. This tool builds one for you and lets you add the parts you need, like a description, favicon links, a stylesheet and a script.

What is the minimum code for a valid HTML5 page?

Six things: <!doctype html>, <html lang="en">, a <head> with <meta charset="utf-8">, <meta name="viewport" content="width=device-width, initial-scale=1"> and a <title>, then a <body>. Strictly speaking the browser fills in missing <html>, <head> and <body> tags for you, but writing them out keeps the page easy to read, and the doctype, charset, viewport and title really matter.

Why does <meta charset="utf-8"> have to come first?

The browser has to know how the text is encoded before it reads any of it. The charset tag must sit within the first 1024 bytes of the file, so the safe habit is to make it the very first line in <head>, before the <title>. A short title before it is still fine, but if a big block of CSS or a long comment pushes it past that point, letters like é or ü can show up as strange symbols.

Should scripts go in the head or at the end of the body?

Put them in the <head> with the defer attribute, like <script src="/js/main.js" defer>. The browser starts downloading the file right away but waits to run it until the HTML is ready, and deferred scripts run in the order you wrote them. The old trick of putting scripts at the end of <body> works too, but the download starts later. A script in the <head> without defer stops the page from showing until it has loaded and run.

What is the difference between defer, async and type="module"?

defer downloads the script alongside the page and runs it after the HTML is read, in order. async also downloads alongside the page but runs the moment it arrives, in any order, which suits independent scripts like analytics. type="module" is for JavaScript that uses import and export; modules are deferred by default, so they wait for the HTML too. For your own main script, defer or type="module" is almost always right.

Do I still need a favicon.ico file?

It's still a good idea. Some browsers and tools ask for /favicon.ico even when the page doesn't link to it. A common setup today is a small favicon.ico, an SVG icon for modern browsers, and a 180×180 apple-touch-icon.png for iPhone home screens. The Favicon Generator on this site makes all three files and the tags.

Is this the same as the HTML5 Boilerplate project?

No. HTML5 Boilerplate is a separate open-source project that gives you a whole folder of files, including server settings and a build setup. This tool makes one index.html with only the parts you tick, which is often all you need for a small site, a test page or a school project. Nothing stops you from using both.

How do I make a blank HTML page?

Pick the Blank layout and press Download. You get index.html with the doctype, the language, the charset, viewport and title tags and an empty <body>. Open the file in any text editor, write your HTML between <body> and </body>, then open it in a browser to see it. You can also paste it into the HTML Editor on this site and see it update as you type.