Quick answer
tan = so; goes before an adjective or an adverb, never changes form.
tanto = so much / so many; goes with a noun or after a verb, and agrees: tanto, tanta, tantos, tantas.
Comparisons: tan … como with adjectives, tanto … como with nouns.
Side by side
Memory trick
Look at the next word. Adjective or adverb takes tan. Noun, or nothing at all because a verb came first, takes tanto with the right ending.
Typical mistakes
Hay tan gente en la calle.
Hay tanta gente en la calle.
Gente is a noun, so it needs tanta, matching feminine singular. Tan can never sit in front of a noun.
Es tanto difícil.
Es tan difícil.
Difícil is an adjective, and adjectives take the short invariable form tan.
Check yourself
Fill in: "Nunca había visto ___ coches en un aparcamiento."