Actually Keyword density depends upon the ratio of your keywords in light of the total number of indexable words placed in your webpage.
For example, you have 100 words article, then having a 1% keyword ratio means that you should have the presence of your keyword one time within that 100 word text.
Google’s recommended keyword density ranges from 1-2% and
Yahoo’s recommended keyword density is at 3%.
Important tips for rank well is You don’t need to really count if you have a 2% ratio. Just try to be mindful to insert your keywords when necessary. Don’t overdo it. Write for people because in the end, it’s people who will be reading what you have to say.
It is calculated in percentage as numbers of time keywords or pharse repeated on a page compared to total number of words appear at that page. Normally it should be between 2-3% for better SEO optimization.