SEO Word Counter & Content Analyzer
Analyze your content quality, SEO metrics and readability.
Start writing your content here…
0
Words
0
Characters
0
Characters Without Spaces
0
Sentences
0
Paragraphs
0
Reading Time
0%
Keyword Density
0
Headings Count
0
Links Count
0
Images Count
0
Flesch Readability
0%
Passive Voice
const editor=document.getElementById("editor");
editor.addEventListener("input",update);
document.querySelectorAll("input,textarea") .forEach(el=>el.addEventListener("input",update));
function format(command){
document.execCommand(command,false,null);
editor.focus();
}
function heading(tag){
if(tag){
document.execCommand( "formatBlock", false, tag );
}
editor.focus();
}
function addLink(){
let url=prompt("Enter URL");
if(url){
document.execCommand( "createLink", false, url );
}
}
function imageUpload(){
document.getElementById("image").click();
}
document.getElementById("image") .addEventListener("change",function(){
let file=this.files[0];
let reader=new FileReader();
reader.onload=function(e){
document.execCommand( "insertImage", false, e.target.result );
update();
}
reader.readAsDataURL(file);
});
function update(){
let text=editor.innerText.trim();
let words=text.match(/\b[\w'-]+\b/g)||[];
document.getElementById("words").innerHTML=words.length;
document.getElementById("characters").innerHTML=text.length;
document.getElementById("charactersNoSpace").innerHTML= text.replace(/\s/g,"").length;
let sentences=text.split(/[.!?]+/) .filter(x=>x.trim());
document.getElementById("sentences").innerHTML= sentences.length;
document.getElementById("paragraphs").innerHTML= text.split(/\n+/).filter(x=>x.trim()).length;
document.getElementById("reading").innerHTML= Math.ceil(words.length/200)+" min";
let keyword=document.getElementById("keyword").value.toLowerCase();
if(keyword){
let count=text.toLowerCase().split(keyword).length-1;
document.getElementById("density").innerHTML= ((count/words.length)*100).toFixed(2)+"%";
}
document.getElementById("headings").innerHTML= editor.querySelectorAll("h1,h2,h3,h4,h5,h6").length;
let links=editor.querySelectorAll("a");
document.getElementById("links").innerHTML= links.length;
document.getElementById("images").innerHTML= editor.querySelectorAll("img").length;
let syllables=0;
words.forEach(word=>{
let m=word.match(/[aeiouy]{1,2}/gi);
if(m) syllables+=m.length;
});
let score=206.835- 1.015*(words.length/(sentences.length||1))- 84.6*(syllables/(words.length||1));
document.getElementById("readability").innerHTML= Math.round(score);
document.getElementById("passive").innerHTML="0%";
}
function clearText(){
editor.innerHTML="";
update();
}
function copyText(){
navigator.clipboard.writeText(editor.innerText);
alert("Copied Successfully!");
}
update();