Keyword density is the relative number of times a keyword or phrase appears in contrast to the amount of content on a page. High keyword density may indicate to search engines that the page is spam and should be penalized. However, a keyword should appear at least a few times (with variations!) on a page in order to indicate to search engines that this is the focus of the page. There is no fixed optimal percentage to target, optimize at your discretion.
How do you calculate keyword density?
Keyword density is calculated by dividing the number of times a keyword appears by the number of total words within the content text for the page. Multiply the result by 100, and the resulting percentage is your answer.
If keyword density is too high, it is called keyword stuffing, which has a negative impact on SEO.