The places search engines look for keywords in your HTML
Search engines read your HTML code to understand what your page is about. They pay closest attention to certain tags — the title tag, heading tags, and the text inside links — because these are the places you would naturally put your most important words. Keywords in these locations signal to search engines that your page is relevant to those terms.
The tag that matters most is the title tag, which appears in the browser tab and in search results. This is where you should put your primary keyword. The second most important location is your heading tags — the H1, H2, and H3 tags that structure your page. Search engines treat these as signals about what the page covers. The third is the text you use in links, both links pointing to your page and links you create to other pages.
Meta descriptions, image alt text, and the body text of your page also matter, but less than these three. The key principle is this: put your keywords where they belong naturally, in the places where a human reader would expect to see them.
Key Takeaways
- The title tag — the text between <title> and </title> in your HTML head — is the single most important place for your primary keyword and appears in search results.
- Your H1 heading (the main headline on the page) should contain your primary keyword and describe what the page is actually about.
- Link text — both the words you use to link to other pages and the words other sites use to link to you — tells search engines what your page is about.
- Meta descriptions and image alt text do not directly affect rankings but help search engines understand your content and can improve click-through rates from search results.
- Keyword stuffing — repeating keywords unnaturally — can hurt your rankings, so focus on writing for humans first and placing keywords where they fit.
How to write an effective title tag
The title tag is the HTML code that tells both the browser and search engines what your page is called. It lives in the <head> section of your HTML, above the <body> tag. Here is what it looks like:
<title>Best Coffee Makers Under $100 | Reviews and Buying Guide</title>
Keep your title tag between 50 and 60 characters so it displays fully in search results without being cut off. Put your main keyword near the beginning — in this example, "coffee makers" appears first. Include a modifier like "best", "reviews", or "guide" to make it more specific and to match the way people actually search. Add your brand name or site name at the end if you have room, separated by a pipe symbol or dash.
Write a title that makes sense to a human reader, not just to a search engine. Someone scanning search results should understand immediately what your page covers and why they should click it.
Using heading tags to organize keywords
Heading tags — H1, H2, H3, and so on — structure your page and tell search engines what each section is about. Your page should have exactly one H1 tag, which is your main headline. This H1 should contain your primary keyword and accurately describe the page content.
Here is an example structure:
<h1>How to Choose the Best Coffee Maker for Your Kitchen</h1>
Below that, use H2 tags for major sections. Each H2 can include related keywords or variations of your main keyword:
<h2>Drip Coffee Makers vs. French Press</h2> <h2>Best Budget Coffee Makers</h2> <h2>Programmable Coffee Makers with Timers</h2>
Use H3 tags for subsections within those H2 sections. This hierarchy helps search engines understand your page structure and lets you naturally include keyword variations throughout your content. Do not skip heading levels — do not jump from H1 to H3 — because that confuses both search engines and screen readers used by people with vision disabilities.
Writing link text that includes keywords
The text you use to create a link — called anchor text — tells search engines what the linked page is about. When you link to another page on your own site or to an external site, use descriptive words that include your keyword when it makes sense.
Instead of this:
<a href="/coffee-makers">click here</a>
Write this:
<a href="/coffee-makers">best coffee makers under $100</a>
The second version tells search engines that the linked page is about affordable coffee makers. This matters both for the page you are linking to and for your own page — search engines use link text to understand what your content covers.
When other websites link to you, the anchor text they use also signals to search engines what your page is about. You cannot control what text other sites use, but you can influence it by making your page title and headings clear and specific. If your page is titled "Best Coffee Makers Under $100", other sites are more likely to link to you using words like "affordable coffee makers" or "budget coffee makers".
Meta descriptions and what they do
The meta description is a short summary of your page that appears below the title in search results. It does not directly affect your ranking, but it influences whether people click your result. Here is the HTML:
<meta name="description" content="Compare the top-rated coffee makers under $100. Read reviews, see features, and find the best option for your budget.">
Keep your meta description between 150 and 160 characters. Include your primary keyword naturally — do not force it in. Write a sentence that tells someone in the search results what they will find on your page and why they should visit. Search engines sometimes rewrite meta descriptions to match a user's search query, so do not worry if your description does not appear exactly as written.
A good meta description answers the question: "What will I learn or find if I click this result?" Make it specific enough that someone can decide whether your page answers their question.
Image alt text for keywords and accessibility
Alt text is the description you write for images in your HTML. It serves two purposes: it helps people using screen readers understand what an image shows, and it gives search engines information about your content. Here is the HTML:
<img src="coffee-maker.jpg" alt="stainless steel drip coffee maker with programmable timer">
Write alt text that describes what the image actually shows. If your image is a coffee maker, describe the coffee maker — its type, color, and key features. Include a keyword when it fits naturally, but do not stuff keywords into alt text. The primary purpose of alt text is to help people understand your image, not to rank for search terms.
Search engines can now analyze images directly, but alt text remains important for accessibility and for images that do not display properly. Keep alt text between 8 and 125 characters and write in plain language.
Where keywords should not go
Avoid putting keywords in places where they do not belong naturally. Do not repeat your keyword multiple times in your title tag, heading, or body text just to rank higher — this is called keyword stuffing and search engines penalize it. A page about coffee makers should mention "coffee makers" a few times naturally, not dozens of times.
Do not hide keywords in white text on a white background, in tiny font, or in code comments. Do not create hidden text layers or use any technique meant to deceive search engines. These tactics violate search engine guidelines and can result in your page being removed from search results entirely.
Do not put keywords in your HTML in places that do not make sense to a human reader. If you would not write it that way for a person visiting your site, do not write it that way for search engines. Search engines have become very good at detecting when content is written for machines instead of people, and they rank it lower as a result.
Frequently Asked Questions
How many times should I use my keyword in my HTML?
There is no magic number. Use your keyword naturally in your title tag, H1 heading, and a few times in your body text. If your page is 2,000 words about coffee makers, mentioning "coffee maker" or "coffee makers" 10 to 15 times is normal. If you are forcing it in more than that, you are probably keyword stuffing.
Does the order of keywords in my title tag matter?
Yes. Put your most important keyword first or near the beginning of your title tag. Search engines weight the words at the start of a title more heavily than words at the end. If you are targeting "best coffee makers", put that phrase at the start: "Best Coffee Makers | Reviews" rather than "Coffee Reviews | Best Makers".
Should I use keywords in my H2 and H3 tags?
Yes, but only when they fit naturally. Your H2 and H3 tags should describe the sections of your page. If a section is about budget coffee makers, use that phrase in the H2 heading. Do not create headings just to include keywords — headings should help readers understand your page structure.
What is the difference between a meta description and body text?
The meta description is a summary that appears in search results and is read by search engines. Body text is the actual content of your page that visitors read. Both can include keywords, but body text is much longer and should focus on answering the reader's question, not on ranking for keywords.
Can I use the same title tag on multiple pages?
No. Each page should have a unique title tag that describes that specific page. If you use the same title on multiple pages, search engines cannot tell which page is about which topic, and both pages will rank worse. Every page needs its own title, heading, and unique content.