What is the difference between vorhin and vorher? Both mean ago in my dictionary. When are they used and in what context?
- Ich habe mit dir vorher gesprochen.
- Ich habe mit dir vorhin gesprochen.
Vorher refers to the time before a certain event like before or prior.
Vorhin is used to point to a single point in time like earlier.
Referring to your examples:
The other answer contains some mistakes that set you up for wrong use of the words.
Refers to an earlier point in time of the same day as in the day you use the word. It usually spans back between 2 and 4 hours from "now".
A translation is earlier but keep in mind that vorhin works like now and always means the current day.
Points at an event in time that has been established in speech and sets another event before that. It is synonymous with davor (before that) in the temporal domain.
More can be found on my blog.