What Is index.html? Meaning, Uses and How to Create One

index.html is the default file that a web server loads when someone visits a website or folder without specifying a file name. It usually acts as the home page of a website. You can create an index.html file using any text editor, add a basic HTML structure and open it in a browser. However, the file name must be written in lowercase and saved with the .html extension for most servers to recognise it correctly.
authorImageVarun Saharawat1 Dec, 2026
index.html Explained

When you visit a website such as example.com, you usually see its home page even though you did not type a file name. In many cases, the server is showing a file called index.html.

Understanding index.html is one of the first steps in learning web development. It helps you understand how websites are structured and how web servers decide which page to display.

In this article, you will learn what index.html is, why it is important, how to create one and how to avoid common mistakes.

What Is index.html?

index.html is the default page that a web server displays when a visitor opens a website or a folder without requesting a specific file.

For example, when someone visits www.example.com, the server may automatically load www.example.com/index.html. The visitor sees the page, but the file name does not appear in the address bar.

The name "index" comes from the idea of an index page that lists or links to the rest of the content on a website.

Why Is index.html Important?

index.html plays an important role in how websites work.

•        It acts as the home page: most websites use index.html as the first page visitors see.

•        It keeps URLs clean: visitors can open example.com instead of example.com/home.html.

•        It is recognised by most web servers: servers such as Apache and Nginx look for index.html by default.

•        It works on hosting platforms: services such as GitHub Pages and Netlify use index.html as the entry point of a static website.

•        It protects folders: if a folder has no index file, some servers may display a list of all files in that folder. An index.html file can prevent this.

How Does a Web Server Use index.html?

When a browser requests a URL that ends with a folder name or a slash, the server follows these steps:

1.     It checks the requested folder.

2.     It looks for a default file, usually index.html.

3.     If the file exists, the server sends it to the browser.

4.     If the file does not exist, the server may show an error or a list of files, depending on its settings.

Servers can also be configured to look for other default files, such as index.php or default.html. However, index.html is the most widely used name for static websites.

Basic Structure of an index.html File

An index.html file uses standard HTML. Here is a simple example:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>My First Website</title>

</head>

<body>

<h1>Welcome to My Website</h1>

<p>This is my first web page.</p>

</body>

</html>

The table below explains each part.

Element Purpose
<!DOCTYPE html> Tells the browser that the page uses HTML5
<html lang="en"> The root element and the language of the page
<head> Contains information about the page, such as its title
<meta charset="UTF-8"> Supports most characters and symbols
<meta name="viewport"> Helps the page display correctly on mobile devices
<title> Sets the text shown on the browser tab
<body> Contains everything visible on the page

To understand each tag in more detail, explore our list of all HTML tags.

How to Create an index.html File?

You can create an index.html file using any text editor.

Using VS Code

1.     Create a new folder for your website.

2.     Open the folder in VS Code.

3.     Create a new file and name it index.html.

4.     Type ! and press Tab to generate a basic HTML structure.

5.     Add your content inside the body tag.

6.     Save the file and open it in your browser.

Using Notepad on Windows

1.     Open Notepad and type your HTML code.

2.     Select File and Save As.

3.     Change Save as type to All Files.

4.     Name the file index.html and select Save.

5.     Double-click the file to open it in your browser.

Make sure the file is not saved as index.html.txt. If file extensions are hidden on your computer, enable them in File Explorer to check the full name.

How to Link Other Pages to index.html?

Most websites have more than one page. You can link other pages from index.html using the anchor tag.

For example, if your folder contains about.html and contact.html, you can add these links inside the body of index.html:

<a href="about.html">About Us</a>

<a href="contact.html">Contact</a>

You can also create index.html files inside subfolders. For example, a file at blog/index.html will load when someone visits example.com/blog/.

Linking pages correctly is one of the basic skills of building websites. Learn how web pages are structured and connected in our guide to web pages.

Common index.html Mistakes and How to Fix Them

Mistake What happens How to fix it
Saving the file as index.html.txt The browser shows code instead of a web page Enable file extensions and rename the file
Using capital letters, such as Index.HTML Some servers, especially on Linux, may not find the file Use lowercase: index.html
Placing the file in the wrong folder The server shows a 404 error or a file list Place index.html in the root folder of your website
Missing <!DOCTYPE html> The browser may display the page in quirks mode Add the doctype on the first line
Broken links to CSS or images Styles or images do not appear Check file paths and folder names

index.html vs index.php vs home.html

File Type When it is used
index.html Static HTML Default page for static websites
index.php Dynamic PHP Default page for PHP websites and platforms such as WordPress
home.html Static HTML Not loaded by default; visitors must type the file name unless the server is configured

Is index.html Important for SEO?

index.html itself is not a ranking factor. However, it is usually the home page of a static website, so its content, title tag and meta description matter for search visibility.

It is also a good practice to make sure that example.com and example.com/index.html do not appear as separate pages in search results. You can use a canonical tag or a redirect so search engines treat them as one page. Learn more about how search engines read web pages in our SEO basics guide.

Start Building Your First Website With index.html

index.html is the starting point of most static websites. It tells the server which page to show first, keeps URLs clean and helps organise your website.

Create your first index.html file, add a few links and open it in a browser. Once you understand the basics, you can add CSS for design and JavaScript for interactivity. Test your understanding with our 50 most asked basic coding questions.

 

Index HTML FAQs

What is index.html in simple words?

index.html is the default home page of a website. A web server loads it automatically when someone visits a website or folder without typing a file name.

Is index.html mandatory for a website?

It is not mandatory, but most servers look for it by default. Without it, you may need to configure the server or ask visitors to type the full page name.

Can I rename index.html?

You can, but the server will not load it automatically unless you change the server settings. For most beginners, it is best to keep the name index.html.

Should index.html be lowercase?

Yes. Many web servers are case-sensitive, so Index.html and index.html may be treated as different files.
avatar

Get Free Counselling Today

and Clear up all your Doubts

Talk to Our Counsellor just by filling out the form.
Student Name
Phone Number
IN
+91
OTP
Email Id
Join 15 Million students on the app today!
Point IconLive & recorded classes available at ease
Point IconDashboard for progress tracking
Point IconLakhs of practice questions
Download ButtonDownload Button
Banner Image
Banner Image