HTML Editors: Create and Preview Your First Web Page
Learn how to use a text or code editor to create an HTML file, save it with UTF-8 encoding and preview it in a browser.
Choose a text or code editor
An HTML file is plain text, so you can create one in a basic text editor or a code editor. A code editor can add syntax highlighting and helpful editing tools, but you do not need a special editor to begin.
Create and save an HTML file
- Create a new file in your editor.
- Write a basic HTML document, including a doctype, a head and a body.
- Save the file with an
.htmlextension and UTF-8 encoding. - Open the saved file in a browser. After making edits, save and refresh the browser.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My first page</title>
</head>
<body>
<h1>Welcome</h1>
<p>My first paragraph.</p>
</body>
</html>
You can also try the site's online HTML editor.
Open the first-page demo (opens in a new tab)
Fix common first-page problems
- If the browser displays your code as text, check that the file ends in
.htmland was not saved as.html.txt. - If a change does not appear, save the file and refresh the browser tab.
- If punctuation or other characters look incorrect, save the document using UTF-8 encoding.
A basic page with local text and styles can be opened directly in a browser. Features that load modules, make network requests or use some browser APIs may need an HTTP development server instead of a file:// address.
For a step-by-step overview of document structure, review the HTML document structure lesson. MDN also explains creating the content for a first website.