SEO Title Analyzer
Analyze your SEO title for length, keywords, readability,
and search visibility.
0 words
(function(){
const titleInput=document.getElementById("hst-title");const keywordInput=document.getElementById("hst-keyword");const analyzeButton=document.getElementById("hst-analyze");
const chars=document.getElementById("hst-chars");const words=document.getElementById("hst-words");
const results=document.getElementById("hst-results");
function countWords(text){return text.trim()?text.trim().split(/\s+/).length:0}
function updateCounter(){
const title=titleInput.value;
chars.textContent=title.length;words.textContent=countWords(title);
}
titleInput.addEventListener("input",updateCounter);
analyzeButton.addEventListener("click",function(){
const title=titleInput.value.trim();const keyword=keywordInput.value.trim().toLowerCase();
if(!title){
alert("Please enter an SEO title first.");return;
}
const titleLength=title.length;const wordCount=countWords(title);
let score=100;let tips=[];
if(titleLength<30){score-=15;tips.push("Your title may be too short. Add useful context that clearly describes the page.")}else if(titleLength>65){
score-=10;
tips.push("Your title may be long. Remove unnecessary words and keep the main topic prominent.");
}
document.getElementById("length-message").textContent=titleLength>=30&&titleLength<=65?"Good practical length.":"Consider making the title more concise or descriptive.";if(keyword){if(title.toLowerCase().includes(keyword)){document.getElementById("keyword-message").textContent="Your target keyword appears in the title."}else{score-=20;document.getElementById("keyword-message").textContent="Your target keyword was not found in the title.";tips.push("Consider including the main keyword naturally if it accurately describes the page.")}}else{document.getElementById("keyword-message").textContent="Add a target keyword for a more specific analysis."} if(wordCount<4){score-=10;tips.push("Your title may need more context.")} document.getElementById("words-message").textContent=wordCount+" words detected.";const longWords=title.split(/\s+/).filter(word=>word.length>15).length;
if(longWords>1){
score-=10;
document.getElementById("readability-message").textContent="Consider simplifying unusually long words.";
tips.push("Use clear, natural language that is easy to understand.");
}else{
document.getElementById("readability-message").textContent="Your title appears easy to scan.";
}
score=Math.max(0,Math.min(100,score));
document.getElementById("hst-score").textContent=score;
if(score>=80){
document.getElementById("hst-score-message").textContent="Strong title. Consider the suggestions below for further improvement.";
}else if(score>=60){
document.getElementById("hst-score-message").textContent="Good start, but there are opportunities to improve it.";
}else{
document.getElementById("hst-score-message").textContent="Your title needs some optimization before publishing.";
}
document.getElementById("hst-preview-title").textContent=title;
if(tips.length===0){
tips.push("Keep the title unique and clearly aligned with the page content.","Avoid repeating the same keyword unnecessarily.","Write for users first, not search engines.");
}
const tipsList=document.getElementById("hst-tips-list");
tipsList.innerHTML="";
tips.forEach(function(tip){
const li=document.createElement("li");
li.textContent=tip;
tipsList.appendChild(li);
});
results.style.display="block";
results.scrollIntoView({behavior:"smooth",block:"start"});
});
updateCounter();
})();