This page contains everything you need to perform (and understand) word and character counting: A fully functional word counter, detailed explanation of the code powering it, and a dump of the entire HTML, CSS, and JavaScript code that the tool uses.
Character Counter
Adding A Character Counter To The WordPress Excerpt Box
Custom excerpts are better for UI/UX because in their absence, most WordPress themes will just grab text from your content. But writing custom excerpts of proper length can be tricky. What you need is a character counter on your WordPress excerpt box!