In your carry-on
Bottles and sprays of 3.4 oz (100 ml) or less go in your quart-size bag with your other liquids. The limit is the size of the container, however much is left in it.
In a checked bag
The FAA caps toiletries at 500 ml (17 fl oz) a container and 2 liters (68 fl oz) a person in total, aerosols included. TSA quotes both numbers on its sunscreen entry.
A spray can needs its cap on, or some other way to stop the nozzle going off.
Flying home from abroad
TSA’s answer covers screening at US airports. On the way home you go through the other airport’s screening first, and its rules are the ones that count there.
TSA puts this on every entry: “The final decision rests with the TSA officer on whether an item is allowed through the checkpoint.”