These two words have similar meanings, which causes confusion. Both have to do with diminishment, but the thing being diminished makes the difference in which word to use.
If an object can be combined, like gasoline, then there is less gasoline. If an object cannot be combined, like boxes, then there are fewer boxes.
However, less also means of poorer quality. “Drugs made him a lesser man.”
With this in mind, consider a moving business’s radio commercial, wherein they gave some good advice mingled with horrible grammar. To save money, hold a garage sale and get rid of things you don’t want to spend money to move. “The less boxes you have,” the commercial’s voice-over dude said, “the less boxes you have to move.”
Grammatically, the commercial is saying the poorer the quality of boxes you have, the poorer the quality of boxes you have to move, which is very wrong on so many levels. The commercial should have said, “The fewer boxes you have, the fewer boxes you have to move.”
If you cannot combine the subject of your sentence, boxes, people, light bulbs, etc, use the word “fewer”. If you can combine the subject of your sentence, gasoline, water, air, etc, use the word “less”.
This is less air in the tire than before.
There are fewer bottles of air than before.
With less gasoline available, the price rises.
My car's tank holds fewer gallons of gasoline than my truck.
I have less stuff to move.
I have fewer boxes to move.