Tool Blog HTML Cheat Sheet 2025
← Back to Tool
📋

HTML Cheat Sheet 2025 — Every Tag, Every Attribute, Real Examples

Let's be honest — nobody memorizes every HTML tag. Even developers with ten years of experience Google stuff. That's completely normal. What matters is knowing where to look quickly. This HTML cheat sheet is that place. Everything you need, organized cleanly, with working code examples you can copy and use right now.

✍️ By UTS Sites 📅 Updated: 2025 ⏱️ 12 min read 🔖 Bookmark This Page

Want to test any HTML tag from this cheat sheet instantly? Paste the code into our free HTML Editor Online Pro and see it render live in your browser — no installation, no signup needed.

📄

The HTML Document Structure — Start Here Every Time

Every HTML file you ever create needs to start with this basic structure. Think of it as the skeleton that holds everything else. Get this right once, and you can just copy it as your starting template forever.

HTML — Basic Document Structure <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Your page description here"> <title>Your Page Title</title> <link rel="stylesheet" href="styles.css"> </head> <body> <!-- All visible content goes here --> <h1>Hello World</h1> <script src="script.js"></script> </body> </html>

Here is what every single line does and why it matters:

  • <!DOCTYPE html> — Tells the browser this is HTML5. Without this, the browser goes into "quirks mode" and your page might render incorrectly. Always the very first line.
  • <html lang="en"> — The root element that wraps everything. The lang attribute is important for screen readers and SEO — it tells Google and accessibility tools what language the page is in.
  • <meta charset="UTF-8"> — Ensures special characters, symbols, and international letters display correctly. Without this, things like é, ñ, ü can break.
  • <meta name="viewport"...> — Absolutely critical for mobile responsiveness. Without this meta tag, your page will look zoomed-out and tiny on phones.
  • <meta name="description"> — The text that appears under your page title in Google search results. Very important for SEO and click-through rates.
  • <title> — The text shown in the browser tab and in Google search results. Make it descriptive and include your target keyword.
  • <link rel="stylesheet"> — Links your external CSS file. Place this in the <head> so styles load before the page content appears.
  • <script src="..."> — Links your JavaScript file. Placed just before </body> so the HTML loads first, preventing slow page rendering.
📝

Text and Heading Tags

Text is the backbone of every webpage. These are the HTML tags you will use more than any others — every day, in every project.

Headings — h1 through h6

HTML gives you six levels of headings. Think of them like a book: h1 is the book title, h2 is a chapter title, h3 is a section within that chapter, and so on. Every page should have exactly one h1 — Google uses it as the primary signal for what the page is about.

<h1>Page Title — Most Important (Use Only Once)</h1> <h2>Major Section Heading</h2> <h3>Subsection Heading</h3> <h4>Minor Heading</h4> <h5>Small Heading</h5> <h6>Smallest Heading</h6>
💡

SEO Tip: Use your target keyword in the h1. Use related keywords naturally in h2 and h3 headings. Google reads your headings first when deciding what a page is about.

Paragraph, Bold, Italic, and Inline Text Tags

<p>A regular paragraph of text. Most of your content lives in p tags.</p> <strong>Bold and semantically important text</strong> <b>Bold text — visual only, no semantic meaning</b> <em>Italic and emphasized text — semantic meaning</em> <i>Italic text — visual only (used for icons, foreign words)</i> <mark>Highlighted / marked text</mark> <small>Smaller text — great for captions and legal text</small> <del>Strikethrough — deleted text</del> <ins>Underlined — inserted/added text</ins> <sub>Subscript text</sub> <!-- Like H₂O --> <sup>Superscript text</sup> <!-- Like E=mc² --> <code>Inline code snippet</code> <pre>Preformatted text — preserves spaces and line breaks</pre> <blockquote>A long quotation from another source</blockquote> <br> <!-- Line break — no closing tag needed --> <hr> <!-- Horizontal rule / divider line -->
🔗

Links and Navigation Tags

Links are what makes the web a "web." The anchor tag <a> is one of the most powerful — and most commonly misused — tags in HTML. Here is everything you need to know about it.

<!-- Basic link --> <a href="https://utssites.com">Visit UTS Sites</a> <!-- Open in a new tab --> <a href="https://utssites.com" target="_blank" rel="noopener noreferrer">Open in New Tab</a> <!-- Link to a section on the same page --> <a href="#contact">Jump to Contact Section</a> <section id="contact">...</section> <!-- Email link --> <a href="mailto:[email protected]">Send us an Email</a> <!-- Phone link --> <a href="tel:+919896991330">Call Us</a> <!-- Download link --> <a href="file.pdf" download>Download PDF</a>
⚠️

Always add rel="noopener noreferrer" when using target="_blank". Without it, the new tab can access your page through window.opener — a security vulnerability. This is a very common mistake.

🖼️

Image and Media Tags

Images can make or break a webpage — both visually and in terms of performance. Here is how to use them correctly in HTML.

<!-- Basic image --> <img src="photo.jpg" alt="A beautiful landscape photo" width="800" height="600"> <!-- Lazy loading image (improves page speed) --> <img src="photo.jpg" alt="Description" loading="lazy"> <!-- Responsive image with srcset --> <img src="photo-800.jpg" srcset="photo-400.jpg 400w, photo-800.jpg 800w, photo-1200.jpg 1200w" sizes="(max-width: 600px) 100vw, 800px" alt="Responsive image"> <!-- Figure with caption --> <figure> <img src="chart.png" alt="Sales chart for 2025"> <figcaption>Fig 1: Monthly sales data for Q1 2025</figcaption> </figure> <!-- HTML5 Video --> <video controls width="640" poster="thumbnail.jpg"> <source src="video.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> <!-- HTML5 Audio --> <audio controls> <source src="audio.mp3" type="audio/mpeg"> </audio>
💡

SEO Tip: The alt attribute is not optional — it is essential. Google's image search reads alt text to understand what the image shows. Also, missing alt text is an accessibility failure. Always write descriptive, specific alt text for every image.

📋

List Tags — Ordered, Unordered, and Description Lists

Lists are one of the most underrated HTML elements. Google loves well-structured lists — they often get pulled into featured snippets at the top of search results. Use them whenever you are listing items, steps, or definitions.

<!-- Unordered list (bullet points) --> <ul> <li>First item</li> <li>Second item</li> <li>Third item</li> </ul> <!-- Ordered list (numbered) --> <ol> <li>Step one — do this first</li> <li>Step two — then do this</li> <li>Step three — finish here</li> </ol> <!-- Nested list --> <ul> <li>Frontend Development <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </li> </ul> <!-- Description list (term + definition) --> <dl> <dt>HTML</dt> <dd>HyperText Markup Language — the structure of the web</dd> <dt>CSS</dt> <dd>Cascading Style Sheets — the design of the web</dd> </dl>
📊

Table Tags — Display Data Properly

HTML tables get a bad reputation because people used to use them for page layouts — which is wrong. Tables are for tabular data only — things that actually belong in rows and columns. When used correctly, they are very useful and semantic.

<table> <thead> <tr> <th>Name</th> <th>Role</th> <th>Experience</th> </tr> </thead> <tbody> <tr> <td>Arjun Singh</td> <td>Frontend Developer</td> <td>3 years</td> </tr> <tr> <td>Priya Sharma</td> <td>UI/UX Designer</td> <td>5 years</td> </tr> </tbody> <tfoot> <tr> <td colspan="3">Total: 2 team members</td> </tr> </tfoot> </table>

The full table tag reference:

TagPurpose
<table>The container for the entire table
<thead>Groups the header row(s) — tells the browser and screen readers this is the header
<tbody>Groups the body rows — the main data content
<tfoot>Groups footer row(s) — totals, summaries, notes
<tr>Table row — wraps one row of cells
<th>Table header cell — bold and centered by default, semantically a header
<td>Table data cell — regular data content
colspan="n"Attribute to make a cell span across n columns
rowspan="n"Attribute to make a cell span across n rows
scroll
📬

Form Tags — Collecting User Input

Forms are how websites collect information from users — login forms, contact forms, search bars, checkout pages. HTML forms are powerful and complex. Here is everything you need in one place.

<form action="/submit" method="POST"> <!-- Text input --> <label for="name">Full Name</label> <input type="text" id="name" name="name" placeholder="Enter your name" required> <!-- Email input --> <input type="email" name="email" placeholder="[email protected]" required> <!-- Password input --> <input type="password" name="password" minlength="8"> <!-- Number input --> <input type="number" name="age" min="1" max="120"> <!-- Dropdown select --> <select name="country"> <option value="">Select country</option> <option value="in">India</option> <option value="us">United States</option> </select> <!-- Textarea --> <textarea name="message" rows="5" placeholder="Your message..."></textarea> <!-- Checkbox --> <input type="checkbox" id="agree" name="agree"> <label for="agree">I agree to the terms</label> <!-- Radio buttons --> <input type="radio" name="gender" value="male"> Male <input type="radio" name="gender" value="female"> Female <!-- File upload --> <input type="file" name="resume" accept=".pdf,.doc,.docx"> <!-- Submit button --> <button type="submit">Send Message</button> </form>

All input types available in HTML5:

TypeWhat it does
type="text"Plain single-line text input
type="email"Email input with built-in format validation
type="password"Password field — hides characters as you type
type="number"Numeric input with optional min/max/step
type="tel"Phone number input — shows numeric keyboard on mobile
type="url"URL input with format validation
type="date"Date picker — shows a calendar UI
type="time"Time picker
type="checkbox"Checkbox — toggles true/false
type="radio"Radio button — one option from a group
type="range"Slider input for a range of values
type="color"Color picker UI
type="file"File upload input
type="search"Search input with a clear button
type="hidden"Hidden field — not visible, but submitted with form
type="submit"Submit button
type="reset"Resets all form fields to defaults
scroll
🏗️

Semantic HTML5 Layout Tags

Before HTML5, developers built page layouts using <div> for everything — <div id="header">, <div id="footer">, <div id="nav">. HTML5 introduced semantic elements that tell both humans and search engines exactly what each part of the page is.

Using semantic HTML is one of the easiest SEO improvements you can make. Google understands the structure of your page much better when you use <header>, <nav>, <main>, and <footer> instead of generic <div> tags everywhere.

<header> <!-- Site logo, main navigation, top bar --> <nav> <ul> <li><a href="/">Home</a></li> <li><a href="/about">About</a></li> </ul> </nav> </header> <main> <!-- The primary content of the page -- only one <main> per page --> <article> <!-- Self-contained content: a blog post, news story, comment --> <h1>Blog Post Title</h1> <p>Article content here...</p> </article> <aside> <!-- Sidebar content — related posts, ads, author bio --> </aside> <section> <!-- A thematic grouping of content within the page --> <h2>Related Topics</h2> </section> </main> <footer> <!-- Copyright, footer links, address --> <p>&copy; 2025 UTS Sites. All Rights Reserved.</p> </footer>
Semantic TagWhen to use it
<header>Site header or the header of a section/article. Contains logo, nav, titles.
<nav>Navigation links — main menu, breadcrumbs, pagination
<main>The main content area of the page. Only one per page.
<article>Self-contained content that makes sense on its own: blog post, news article, product card
<section>A thematic group of content, usually with a heading. Like a chapter in a book.
<aside>Content related to but not part of the main content: sidebars, callouts, ads
<footer>Footer of the page or section. Copyright, links, contact info.
<address>Contact information for the nearest article or body element
<time>A specific time or date — use the datetime attribute for machine-readable format
scroll
🔍

Meta Tags for SEO — The Ones That Actually Matter

Meta tags live in the <head> section and are invisible on the page — but they are extremely important for SEO, social media sharing, and how your page appears in search results. Here are the ones that genuinely make a difference.

<!-- Essential meta tags --> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Primary Keyword — Secondary Keyword | Brand Name</title> <meta name="description" content="150-160 character description with keywords. This shows in Google results."> <link rel="canonical" href="https://yoursite.com/this-page/"> <meta name="robots" content="index, follow"> <meta name="author" content="UTS Sites"> <!-- Open Graph tags (for Facebook, LinkedIn, WhatsApp sharing) --> <meta property="og:title" content="Page Title Here"> <meta property="og:description" content="Description for social sharing"> <meta property="og:image" content="https://yoursite.com/og-image.jpg"> <meta property="og:url" content="https://yoursite.com/this-page/"> <meta property="og:type" content="article"> <!-- Twitter Card tags --> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:title" content="Page Title"> <meta name="twitter:description" content="Description"> <meta name="twitter:image" content="https://yoursite.com/twitter-image.jpg">
🎯

Title tag should be 50–60 characters max. Meta description should be 150–160 characters. These are what users see in Google before clicking — write them like ads, not afterthoughts.

HTML Global Attributes — Works on Any Tag

These attributes can be added to almost any HTML element — they are not specific to one tag.

AttributeWhat it doesExample
idUnique identifier for one element on the page. Used by CSS and JS.id="main-header"
classReusable label for styling multiple elements with CSSclass="btn btn-primary"
styleInline CSS styles — avoid for large projects, useful for quick testsstyle="color:red"
titleTooltip text shown on hovertitle="Click to submit"
langLanguage of the element's contentlang="fr"
hiddenHides the element — display:none equivalenthidden
tabindexControls keyboard tab ordertabindex="1"
contenteditableMakes element editable by the user in the browsercontenteditable="true"
data-*Custom data attributes for storing extra info — accessible via JSdata-user-id="123"
aria-labelAccessibility label for screen readersaria-label="Close menu"
draggableMakes the element draggabledraggable="true"
spellcheckEnable/disable browser spell checkingspellcheck="false"
scroll
🚀

Practice Every Tag in This Cheat Sheet — Right Now, Free

Test Any HTML Code Instantly

Copy any code example from this HTML cheat sheet, paste it into HTML Editor Online Pro, and see it rendered live in your browser. Switch between mobile, tablet, and desktop views. No installation, no signup — completely free.

⚡ Open HTML Editor Free →

HTML Cheat Sheet — Frequently Asked Questions

Q: How many HTML tags are there in total?
HTML5 officially has over 110 tags. But realistically, about 30–40 tags cover 95% of everything you will ever build. This cheat sheet covers all the important ones. You do not need to memorize every tag — just know where to look.

Q: What is the difference between <strong> and <b>?
Both make text bold visually. But <strong> has semantic meaning — it tells search engines and screen readers "this text is important." Use <strong> for genuinely important content. Use <b> only when you want bold styling without any semantic weight — like styling a product name in a list.

Q: What is the difference between <div> and <span>?
<div> is a block-level element — it takes up the full width and starts on a new line. <span> is an inline element — it sits inside text without breaking the line. Use <div> for sections of layout. Use <span> to style specific words or characters within text.

Q: Do HTML tags need to be lowercase?
HTML is not case-sensitive, so technically no. But lowercase is the universal standard convention. Using uppercase tags like <DIV> is outdated and will make other developers (and future you) uncomfortable. Always use lowercase.

Q: What is a void element in HTML?
A void element is a tag that does not have a closing tag because it cannot contain content. Examples include <img>, <input>, <br>, <hr>, <meta>, and <link>. In HTML5, you do not need to self-close them with a slash (like <br />) — that was an XHTML requirement. Plain <br> is perfectly valid HTML5.

Q: Should I use HTML tables for page layout?
Absolutely not. Tables are for tabular data — information that naturally belongs in rows and columns, like a spreadsheet. Using tables for page layout was common before CSS existed, but it is completely wrong in modern web development. Use CSS Flexbox or CSS Grid for layouts.