Why Checking Keyword Placement Matters
Knowing whether your target keyword appears on a page is fundamental to SEO, but the answer is rarely as simple as yes or no. A keyword might appear in the body text but be missing from the title tag. It might be in the H1 but absent from image alt attributes. Each placement location sends a different relevance signal to search engines, and a comprehensive check reveals gaps that basic search misses.
Beyond simple presence, you need to know frequency, placement, and context. A keyword appearing 15 times in a 500-word page might signal keyword stuffing. The same keyword appearing 3 times distributed across the title, H1, and first paragraph signals focused relevance. The tools and techniques below give you complete visibility into keyword placement.
Browser Search: Fast but Limited
Press Ctrl+F (Cmd+F on Mac) to open the browser search bar and type your keyword. The browser highlights every visible instance and shows a count. This takes two seconds but only searches rendered text. It does not find keywords in the HTML source, meta tags, alt attributes, schema markup, or comments.
For a deeper search, view the page source with Ctrl+U (Cmd+U on Mac) and search within the raw HTML. This reveals keywords in the title tag, meta description, heading tags, image alt text, anchor text, and hidden elements. Compare the keyword count in visible text versus the source to understand how thoroughly your keyword is distributed across all SEO-relevant locations.
JavaScript Console for DOM-Wide Analysis
The browser console gives you programmatic access to every element in the DOM, including hidden content that visual search misses. Open it with F12, navigate to the Console tab, and run these commands:
// Count keyword in all visible text
const keyword = "technical seo";
const bodyText = document.body.innerText;
const count = bodyText.toLowerCase().split(keyword.toLowerCase()).length - 1;
console.log(`"${keyword}" appears ${count} times in visible text`);
// Check specific SEO locations
const title = document.title.toLowerCase().includes(keyword);
const h1 = document.querySelector("h1")?.innerText.toLowerCase().includes(keyword);
const meta = document.querySelector('meta[name="description"]')?.content.toLowerCase().includes(keyword);
console.log({ title, h1, meta });
To count how many image alt attributes contain your keyword:
const imgs = Array.from(document.querySelectorAll("img"));
const altMatches = imgs.filter(img =>
img.alt.toLowerCase().includes("technical seo")
).length;
console.log(`Alt text matches: ${altMatches} of ${imgs.length} images`);
This JavaScript approach works on any page, including competitor pages you do not own. Paste the code into your console while viewing their content to analyze their keyword strategy without needing access to their server or analytics.
Terminal-Based Searching for Bulk Audits
When you need to check keyword presence across multiple pages, curl and grep from the terminal is faster than opening each page in a browser. The -s flag silences progress output, and grep searches the HTML for your keyword:
# Single page keyword count
curl -s https://example.com/blog/post | grep -oi "technical seo" | wc -l
# Search within title tags specifically
curl -s https://example.com/blog/post | grep -oP "<title>[^<]*</title>" | grep -i "technical seo"
# Audit keyword presence across 10 pages
for url in $(cat urls.txt); do
count=$(curl -s "$url" | grep -oi "technical seo" | wc -l)
echo "$url: $count occurrences"
done
The -o flag in grep outputs only the matching text, and -i makes the search case-insensitive. Pipe through wc -l to count occurrences. This approach works for competitor analysis since you only need the public URL to fetch and search the content.
Programmatic Checking in PHP
If you manage a WordPress or Laravel site, you can build a keyword audit script that checks your own content programmatically. Fetch each page, parse the HTML, and search specific elements:
<?php
$pages = [
'https://yoursite.com/page-1',
'https://yoursite.com/page-2',
];
$keyword = 'technical seo';
foreach ($pages as $url) {
$html = file_get_contents($url);
$dom = new DOMDocument();
@$dom->loadHTML($html);
$title = $dom->getElementsByTagName('title')->item(0)->textContent;
$h1 = $dom->getElementsByTagName('h1')->item(0)->textContent ?? 'N/A';
$body = $dom->getElementsByTagName('body')->item(0)->textContent;
$titleHas = stripos($title, $keyword) !== false;
$h1Has = stripos($h1, $keyword) !== false;
$bodyCount = substr_count(strtolower($body), strtolower($keyword));
echo "$url\n";
echo " Title: " . ($titleHas ? 'YES' : 'NO') . " - $title\n";
echo " H1: " . ($h1Has ? 'YES' : 'NO') . " - $h1\n";
echo " Body count: $bodyCount\n\n";
}
?>
Run this script weekly to track keyword placement changes as you update content. Our keyword in page checker automates this analysis and provides a structured report showing every keyword location across your pages.
Keyword Placement Checklist
For each target page, verify your keyword appears in these locations. Missing any of these weakens your page's relevance signal for that keyword:
- Title tag: Include the keyword, ideally within the first 60 characters so it does not truncate in search results
- Meta description: Use the keyword naturally within the first 155 characters to reinforce relevance in the search snippet
- H1 heading: Your primary heading should contain the exact keyword or a close variation
- First paragraph: Introduce the topic within the first 100 words to signal immediate relevance to crawlers
- H2 or H3 subheading: Use the keyword or a semantic variation in at least one subheading
- Image alt text: Describe your primary image using language that includes the keyword naturally
- URL slug: Include the keyword in the URL path for both relevance and click-through rate
- Internal link anchor text: Link to this page from other relevant pages using descriptive anchor text containing the keyword
Track these placements over time using our keyword in page checker to maintain consistent optimization as you update and expand your content.
Competitor Keyword Placement Analysis
Analyzing where competitors place their target keywords reveals gaps in your own strategy. Open a competing page in your browser, run the JavaScript console commands from above, and compare their keyword distribution against yours. If they include the keyword in three subheadings while you only include it in one, that difference may explain their ranking advantage.
Pay particular attention to competitor image alt text. Many SEO practitioners neglect image optimization, so finding that a top-ranking page has keyword-rich alt text on every image tells you exactly where to focus your optimization efforts. Use the terminal curl and grep approach to extract all alt attributes from a competitor page and count keyword occurrences across them.