Quick difference: Hard can describe something firm or difficult, or tell how much effort went into an action. Hardly means almost not. I worked hard and I hardly worked mean very different things.

Examples explained
Hard as an adjective.
The lid was hard to open.
Why it works: Hard means difficult here. It can also describe a firm surface, as in a hard floor.
Hard as an adverb.
We worked hard to finish the repairs.
Why it works: Hard tells how we worked: with a lot of effort.
Hardly means almost not.
We hardly worked on the repairs that day.
Why it works: We did very little work. Hardly reduces how much happened; it does not describe the effort.
Try with effort or almost not
If you mean with effort or with force, write hard: Push hard. If you mean almost not, write hardly: I could hardly hear means I could barely hear. In standard edited English, use hardly any, not hardly no, when you mean almost none.
Quick check
Choose hard or hardly.
- I studied ___ for the exam, putting in several hours each night.
- The music was so faint that I could ___ hear it.
- The clay turned ___ as it dried.
Reveal the answers and explanations
1. Hard. The sentence describes a great deal of effort.
2. Hardly. The music was almost inaudible from where the speaker was.
3. Hard. The clay became firm. The adjective describes the clay.