hart
hard
Having a firm, resistant quality; not soft.
Das Brot vom Vortag war schon ziemlich hart.
The bread from the day before was already quite hard.

hard
Loading your saved state.
hard
Having a firm, resistant quality; not soft.
Das Brot vom Vortag war schon ziemlich hart.
The bread from the day before was already quite hard.

As an adverb, 'hart' can intensify a verb and then means 'strongly', 'intensely', or 'with a lot of force'. It describes the manner of an action.
Der Autofahrer musste hart bremsen, um einen Unfall zu vermeiden.
The driver had to brake hard to avoid an accident.
In the meaning of 'fest' (firm/solid), 'hart' is often used for materials and foods. Typical examples are 'hartes Holz' (hard wood), 'harter Stein' (hard stone), or a 'hart gekochtes Ei' (hard-boiled egg).
Diese Matratze ist mir zu hart, ich kann darauf nicht schlafen.
This mattress is too hard for me; I can't sleep on it.
When 'hart' means 'anstrengend' (strenuous/exhausting), it often describes periods of time or activities. Common combinations are 'ein harter Tag' (a hard day), 'eine harte Woche' (a hard week), 'harte Arbeit' (hard work), or 'ein harter Kampf' (a hard fight).
Nach der langen Wanderung hatten alle einen harten Muskelkater.
After the long hike, everyone had serious muscle soreness.
The meaning 'dicht bei' (very close to) occurs almost only in fixed expressions with prepositions. The most common one is 'hart an', for example 'hart an der Grenze' (right on the border/limit) or 'hart am Abgrund' (right on the edge of the abyss).
Das Auto parkte hart am Straßenrand.
The car was parked right at the edge of the road.
heavy / difficult
'schwer' and 'hart' can both describe something that takes a lot of strength or effort. 'eine schwere Aufgabe' (a difficult task) and 'eine harte Aufgabe' (a hard task) can both be exhausting. But the difference is important: 'schwer' fits especially with weight or difficulty. 'hart' fits with material, when something is not soft, and also with very exhausting situations. Learners often confuse the words because in some languages they can be translated with the same word. As a practical rule: a suitcase is 'schwer', a stone is 'hart'; an exam can be 'schwer', and a workday can be 'hart'.

Nach zehn Stunden im Lager war der Arbeitstag wirklich hart.
After ten hours in the warehouse, the workday was really hard.
Die Aufgabe war schwer, deshalb brauchte Tom fast eine Stunde.
The task was difficult, so Tom needed almost an hour.