The conventional rule for less and fewer is simple: less applies to singular nouns (including mass nouns), and fewer applies to plural nouns. For example, to have fewer dollars than someone else is to have less money, and to have fewer books is to have less reading material. Money and material, in the senses relevant here, are uncountable things, so they take less, while dollars and books are obviously countable, so they take fewer.
The less/fewer distinction is not always borne out in real-world usage, though. In fact, the rule has been widely broken for centuries, and there is much controversy among people who follow these things over whether it is worth preserving. We won’t explore that controversy here, but it is safe to say that mixing up less and fewer in informal speech or writing is never a serious error. When it comes to more formal contexts, it is worth at least considering that many people strongly believe in the old rule and think that breaking it is a serious error. Whether to pay this any heed is a choice one must make for oneself.