Build Guides

How to Build a Website With HTML: A Beginner's Guide

How to build a website with HTML for beginners: the core structure, real code examples, how to publish it online, plus when using AI is the smarter move.

Mockup browser setengah jadi memperlihatkan rangka blok bertingkat, menggambarkan struktur dasar halaman website HTML.

If you are curious how to build a website with HTML, here is the good news: the basics are far simpler than they look. HTML is just plain text with tags that tell the browser which part is a heading, which is a paragraph, and which is an image. You can get your first page showing in a browser in under ten minutes, with no expensive software, using only the text editor and browser already on your laptop.

In this guide we walk through it step by step from scratch, and then cover one thing most tutorials skip: when writing HTML yourself is a waste of time and using AI is the better call.

I will be honest throughout. Learning HTML is useful and genuinely fun, but having a business website that is live and winning work is a different goal. We will cover both, so you can choose with your eyes open.

What HTML is and why it still matters

HTML stands for HyperText Markup Language. Put simply, it is the language used to structure the content of a web page. Each piece of content is wrapped in a tag, such as <p> for a paragraph or <h1> for a main heading. The browser reads those tags and displays each piece in the right shape.

Even with all the instant tools around today, HTML is still the foundation of almost every page on the web. The fanciest website in the world is, at its lowest layer, still HTML. So understanding the basics gives you useful intuition, even if you later decide not to write it by hand. It is a bit like understanding how a car engine works: you do not have to be a mechanic to drive, but knowing the basics makes you more confident behind the wheel.

What you need before you start

The good news is the toolkit is minimal, and most of it is already installed:

  • A text editor. Where you write the code. Notepad on Windows or TextEdit on Mac is enough for practice. If you want more comfort, download VS Code for free; it color-codes your markup so it is easier to read.
  • A browser. Chrome, Firefox, or Edge already on your computer will show you the result.
  • Later, hosting and a domain. These are only needed when you want your site visible to other people, not just open on your own machine. We cover that near the end.

Nothing needs to be bought to get started. This is one reason HTML is such a popular entry point for learning the web.

Tumpukan blok kecil yang dirakit manual di kiri dan mockup jadi yang rapi di kanan, membandingkan menyusun HTML sendiri dengan memakai AI.
Menyusun HTML sendiri melatih dasar, tapi AI merakit halaman jadi dalam sekejap.

How to build a website with HTML: the basic page structure

Every HTML page has the same skeleton. Open your text editor, type the code below, then save it as index.html (make sure it ends in .html, not .txt).

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sunset Coffee Bar</title>
</head>
<body>
  <h1>Sunset Coffee Bar</h1>
  <p>Manual brew coffee and homemade snacks in the heart of downtown.</p>
</body>
</html>

Let us break it down line by line so you are not just copying:

  • <!DOCTYPE html> tells the browser this is a modern HTML document.
  • <html lang="en"> wraps the whole page and states its language is English. This helps search engines and screen readers.
  • <head> holds information that is not shown directly, such as the tab title and display settings.
  • <meta name="viewport" ...> matters a lot. This line makes the page adapt to phone screens. Without it, your site looks tiny and hard to read on mobile.
  • <title> is the text that appears in the browser tab and in Google results.
  • <body> holds everything the visitor actually sees.

Save the file, then double-click index.html. Your first page opens in the browser. Congratulations, you have officially built a website with HTML.

It helps to picture the whole file as a family tree. <html> is the root, <head> and <body> are its two children, and every other tag is nested somewhere inside one of them. The diagram below shows the finished example page we build in this guide.

Tree diagram of an HTML page: the html element splits into head, holding meta charset, meta viewport and title, and body, holding header with h1 and nav, main with h2, p and ul, and footer with p
How the tags in this guide's example page nest inside each other. Head holds settings for the browser; body holds everything a visitor sees. Diagram: Forgelo.

Tip: Keep all your project files in one dedicated folder, for example coffee-site. Later, when you add images and other pages, everything stays tidy in one place and linking between files is far easier.

That empty skeleton is not useful yet. Now we fill it with the elements small business sites use most. Place all of these inside <body>.

For layered headings, use <h1> through <h6>. Use one <h1> per page for the main name, then <h2> for big sections like "Menu" or "Location".

<h1>Sunset Coffee Bar</h1>
<h2>Our Favorites</h2>
<p>Iced brown sugar latte, V60 pour-over, and warm chocolate banana bread.</p>

For images, use the <img> tag. Put the photo file in the same folder, then name it:

<img src="latte.jpg" alt="Iced brown sugar latte in a clear glass">

Notice the alt attribute. It is a short description of the image. This is not filler: alt helps Google understand the picture and matters for visitors using screen readers.

For links, use the <a> tag. For example, a button to your booking page:

<p>Reserve a table on our <a href="https://example.com/book">booking page</a>.</p>

And for a list, such as opening hours, use <ul> with several <li> items:

<ul>
  <li>Monday to Friday: 8am to 10pm</li>
  <li>Saturday and Sunday: 9am to 11pm</li>
</ul>

With just these four elements, headings, paragraphs, images, and links, you can already build a complete business profile page. If you want to expand this base, our guide to making a website without coding shows the alternative approach side by side.

Making it look decent with a little CSS

At this point your site works but looks plain: black text on a white background, glued to the top-left corner. CSS is the language for controlling appearance, from colors and font sizes to spacing and layout. The easiest way for beginners is to put CSS inside <head> using a <style> tag.

<style>
  body {
    font-family: Arial, sans-serif;
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
    color: #333333;
  }
  h1 { color: #6b4423; }
  a { color: #c2410c; }
</style>

That short block already makes a big difference: the text sits centered at a comfortable width, there is breathing room from the edges, and the heading and links have color. From here you can keep experimenting. Change the max-width number, swap the color codes, adjust the font size, then refresh the browser to see the result instantly.

Note: This is where the learning curve starts to climb. CSS has a lot of rules, and building a layout that looks genuinely polished across every screen size (phone, tablet, laptop) takes weeks of practice. If you enjoy the process, keep going. If you just want a good result without wading into the details, remember there is a shortcut we cover next.

So far the pieces have been scattered. Here is the whole index.html in one place, with one upgrade: the content is grouped into four semantic sections. These tags do not change how the page looks by default, but they tell browsers, search engines, and screen readers what each part is for.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sunset Coffee Bar</title>
  <style>
    body { font-family: Arial, sans-serif; max-width: 700px; margin: 0 auto; padding: 24px; color: #333333; }
    h1 { color: #6b4423; }
    a { color: #c2410c; }
  </style>
</head>
<body>
  <header>
    <h1>Sunset Coffee Bar</h1>
    <nav>
      <a href="#menu">Menu</a> | <a href="#hours">Hours</a>
    </nav>
  </header>
  <main>
    <h2 id="menu">Our Favorites</h2>
    <p>Iced brown sugar latte, V60 pour-over, and warm chocolate banana bread.</p>
    <h2 id="hours">Opening Hours</h2>
    <ul>
      <li>Monday to Friday: 8am to 10pm</li>
      <li>Saturday and Sunday: 9am to 11pm</li>
    </ul>
    <p>Reserve a table on our <a href="https://example.com/book">booking page</a>.</p>
  </main>
  <footer>
    <p>Sunset Coffee Bar, downtown.</p>
  </footer>
</body>
</html>

What each new section means:

  • <header> holds the introductory part of the page, here the business name and the menu links.
  • <nav> wraps a block of navigation links. The href="#menu" links jump to the heading with id="menu" on the same page.
  • <main> holds the content that is unique to this page. According to MDN's reference for the main element, a document must not have more than one visible <main>, so use it once.
  • <footer> holds closing details such as the address or copyright line.
Browser render of the Sunset Coffee Bar example page: a brown Sunset Coffee Bar heading, Menu and Hours links, an Our Favorites section, an Opening Hours list, a booking page link, and a footer line
The complete example code above, rendered in Chromium on a desktop-width window. No images or frameworks, just HTML and a few lines of CSS. Screenshot: Forgelo, November 2026.

That is a real, working one-page website. It is plain, but every part of it is correct, and it gives you a clean base to style further.

The HTML tags you will use most

You do not need to memorize every element in the HTML Living Standard, which has been maintained by the WHATWG since the 2019 agreement between W3C and WHATWG. A small business page leans on a dozen at most:

Tag What it does Typical use on a business page
<h1> to <h6> Headings, from most to least important Business name, section titles
<p> A paragraph of text Descriptions, story, offers
<a href="..."> A link to another page or spot Booking page, WhatsApp, menu jump
<img src="..." alt="..."> An image with a text alternative Product and venue photos
<ul> and <li> A bulleted list Opening hours, services
<header>, <main>, <footer> Page regions with a clear role Top bar, main content, contact line
<nav> A block of navigation links The menu

One detail on alt: MDN's image reference notes that an empty alt="" marks an image as decoration, so screen readers can skip it. Use real descriptions for product photos and the empty value only for purely decorative graphics.

Common beginner mistakes, and how to fix them

Almost everyone hits the same handful of problems on their first HTML page. Check these in order when something looks off:

  1. The file saved as index.html.txt. Some editors add .txt silently. Turn on file extensions in your file manager and rename it.
  2. A missing closing tag. Forget </p> or </a> and the following text inherits the wrong formatting. Most tags need a pair; void elements such as <img> and <meta> do not.
  3. A wrong image path. If the picture shows as a broken icon, the src does not match the file's real name or folder. Latte.jpg and latte.jpg can be different files on many web servers.
  4. No viewport line. Without the <meta name="viewport"> tag, phones render the page as a shrunken desktop view.
  5. Several <h1> tags. Keep one main heading per page and use <h2> for sections, so the outline stays clear.

Fixing these five covers most of the "why does my page look weird" moments in the first week.

How to publish your HTML website so people can see it

A site on your computer cannot be seen by anyone else. For that you need two things: hosting (a place to store the files so they are served over the internet) and a domain (an address like sunsetcoffee.com).

The usual steps look like this:

  1. Pick hosting. For static HTML files, there are free static hosts that are fine for practice or a small site. For a serious business, paid hosting with your own domain looks more professional.
  2. Upload the files. You send index.html along with the image folder to the host, usually through an upload panel or an FTP app.
  3. Point the domain. If you buy a domain, you connect it to the hosting through DNS settings.
  4. Check it on your phone. Open the address on mobile, not just on the laptop. This is the moment many people first notice the layout is a mess on small screens.

This process sounds involved at first, and it does take patience the first time. If you want to compare an approach that skips managing hosting yourself, our walkthrough on how to build a website with AI gives you the fuller picture.

How to build a website with HTML vs using AI: which fits you?

Now for the part most HTML tutorials will not admit. If your goal is genuinely to have a business website that is live and bringing in customers, writing HTML from scratch is often not the fastest route, and not the cheapest either once you count your time.

Here is my honest read after watching plenty of small business owners try it: they are excited for two evenings, the first page comes together, and then they stall on making it tidy on mobile, adding a form, setting up SEO basics, and dealing with hosting. A project meant to be "done this weekend" turns into a month that never quite launches. A half-finished site sitting in a laptop folder wins exactly zero orders.

Let us compare the two routes openly:

Aspect Writing HTML by hand Using an AI website builder
Time to live A few days to weeks A few minutes for a first draft
Coding required Yes, HTML plus CSS No, just describe your business
Mobile-friendly automatically You set it up yourself, needs practice Mobile-friendly out of the box
Lead form to WhatsApp Needs code and an extra service Built in
SEO basics Done by hand, one by one Automatic on every page
Changing content Edit code, then re-upload Just type the change you want
Best for Learning, small personal projects A business site that must go live

With a builder like Forgelo, you describe your business in a single sentence, and a ready-to-publish website appears a few minutes later. Want to change something? Just type "make the headline shorter" or "add a menu section with three options", with no code to touch. Contact forms route straight to your WhatsApp, so customer questions land where you already reply.

Tip: Learning HTML and using AI are not mutually exclusive. Plenty of people learn the HTML basics for understanding, then use a builder for the business site they actually rely on. That HTML foundation still helps you understand and fine-tune whatever the builder produces.

The takeaway

How to build a website with HTML comes down to this: get a text editor, write the <!DOCTYPE html> skeleton, fill the <body> with headings, paragraphs, images, and links, tidy it up with a little CSS, then upload it to hosting. For learning and small projects, this is a valuable and satisfying exercise. You understand how the web works from the roots up, and that is never wasted.

But if what you need is a business website live this week, tidy on mobile, with a WhatsApp form, and editable by you anytime, hand-writing all the HTML is often an expensive detour in terms of time. For that, letting AI handle the technical part while you focus on the content and the customers is usually the wiser call. You can look at the pricing to compare, and start from wherever you are right now. What matters is that your site is live and being seen, not perfect inside a folder.

FAQ

Quick answers

Can I build a website with only HTML, no CSS or JavaScript?

Yes. HTML on its own is enough to show headings, paragraphs, images, and links in a browser. It looks plain, with no colors or polished layout, but it still works as a website. CSS is added to make it look good, and JavaScript adds interactivity. For your first attempt, plain HTML is a satisfying place to start.

What software do I need to write HTML?

Just a text editor and a browser you already have. Notepad on Windows or TextEdit on Mac works fine for practice. If you want more comfort, VS Code is free and color-codes your markup so it is easier to read. You do not need any paid design software to begin.

How long does it take to learn to build a website with HTML?

Getting a single simple page to show in a browser takes an hour or two. Understanding structure, images, links, and enough CSS to look tidy takes a few days of relaxed practice. Building a genuinely good, fast, mobile-friendly business site takes much longer, which is where many people choose a different route.

How do I make my HTML website visible to other people?

You need hosting, a place to store your HTML files so they are served over the internet, and usually a domain as the address. There are free static hosts for HTML files, and paid hosts with your own domain. You upload the files, point the domain, and anyone can open it.

When is it better to use AI instead of writing HTML myself?

If your goal is a business site live this week, mobile-friendly, and editable without learning to code, an AI website builder usually makes more sense. Hand-writing HTML suits learning and small projects. For a real business need, the time you save is often worth more than the pride of writing the code yourself.

Is a hand-coded HTML site good for SEO?

Clean HTML is a solid SEO foundation, but ranking takes more: speed, a clear heading structure, meta descriptions, mobile-friendliness, and content that answers searches. You can do all of that by hand, but it eats time. Modern builders bake in the SEO basics so you can focus on the content.

What is the difference between HTML and CSS?

HTML describes what each piece of content is: a heading, a paragraph, a list, a link. CSS describes how those pieces look: colors, fonts, spacing, and layout. You can have HTML without CSS and the page still works, just plainly. CSS on its own shows nothing, because it needs HTML elements to style.

Do I have to close every HTML tag?

Most tags come in pairs, such as <p> and </p>, and forgetting the closing tag is a classic beginner bug that makes text spill into the wrong place. A small group of tags called void elements, including <img> and <meta>, never take a closing tag at all. When something looks wrong, check your pairs first.

Keep reading

Related guides

Satu jendela browser bersih berisi satu kolom konten rapi dengan banyak ruang kosong, menggambarkan website sederhana satu halaman.
Build Guides

How to make a simple website: one page, done today

How to make a simple website: build one clean, fast page and get it live today, no coding, with a WhatsApp button so real inquiries reach your phone.

7 min read
Browser mockup with a stack of article cards, illustrating a new blog website.
Build Guides

How to make a blog website: a complete beginner's guide

How to make a blog website from scratch: pick the right platform, set up a clean structure, and build a consistent writing habit so your blog actually grows.

11 min read
Jendela browser menyerupai papan informasi warga dengan grid kartu kecil dan bentuk gedung sederhana, menggambarkan website desa.
Build Guides

How to Make a Village Website: Content, Domain, Fast Path

How to make a village website: the must-have content, choosing a domain, DIY with AI versus hiring out, and the fastest way to actually get it live.

8 min read
Start building

Describe your business. Get a website.

Start free, publish in minutes, and edit anything by typing what you want to change.