Keyword density is the percentage of the number of times a keyword appears on a page divided by the total number of words in that page. For example, in a blog of 100 words, if you are using the keywords 10 times, the density will be 10%.
The formula is – (Number of keywords/ Total number of words) * 100
The idea is to use your keywords on a page in a way that the search engine understands your content better which will further help you rank better upon search of those keywords.
Using your keywords in your social media content also plays important role in improving your SEO ranking.
There is no ideal or exact percentage for better ranking but 1-3% of keyword density works best.