Calculate Sellers Closing Costs

SEO Content Analyzer

Check your word count and keyword density instantly for better search engine rankings.

Word Count: 0
Character Count: 0
Keyword Density: 0%
function calculateSEOStats() { var text = document.getElementById('seoContent').value; var keyword = document.getElementById('seoKeyword').value.trim().toLowerCase(); var resultsBox = document.getElementById('seoResults'); if (!text) { alert('Please enter some content to analyze.'); return; } var wordsArray = text.trim().split(/\s+/); var wordCount = wordsArray.length; var charCount = text.length; var density = 0; var keywordOccurrences = 0; if (keyword.length > 0) { var regex = new RegExp('\\b' + keyword.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\\b', 'gi'); var matches = text.match(regex); if (matches) { keywordOccurrences = matches.length; density = (keywordOccurrences / wordCount) * 100; } } document.getElementById('statWords').innerText = wordCount; document.getElementById('statChars').innerText = charCount; document.getElementById('statDensity').innerText = density.toFixed(2) + '%'; var advice = ""; if (wordCount < 300) { advice = "⚠️ SEO Tip: Your content is short. Aim for at least 600-1000 words for better ranking potential."; } else if (density > 3) { advice = "❌ Warning: Keyword density is too high (" + density.toFixed(2) + "%). Reduce keyword usage to avoid keyword stuffing penalties."; } else if (density > 0 && density <= 2.5) { advice = "✅ Great! Your keyword density is optimal for search engines."; } else if (keyword && keywordOccurrences === 0) { advice = "ℹ️ Note: Target keyword not found in the text. Try to include it naturally."; } else { advice = "📝 Ready: Content structure analyzed successfully."; } document.getElementById('seoAdvice').innerHTML = advice; resultsBox.style.display = 'block'; }

Leave a Comment