por looks back: the cause, the way through. para looks ahead: the goal.
SpanishLevel A2
por looks back at the reason or cause (Gracias por todo, thanks for everything). para looks ahead to the goal or the person who gets something (Es para ti, it's for you).
por: the reason (gracias por todo), the way through (por la calle), exchange or rate (10 € por hora), part of the day (por la mañana). para: the recipient (para ti), the destination (para Madrid), a deadline (para el lunes), a purpose (para aprender).
Examples
La cuenta, por favor.
The bill, please.
Una ración de bravas para compartir.
A portion of patatas bravas to share.
Gracias por la invitación.
Thanks for the invitation.
Salimos para Sevilla mañana.
We leave for Seville tomorrow.
Pasamos por el parque.
We went through the park.
Necesito el informe para el viernes.
I need the report by Friday.
Common mistake
Thanks look back at the reason, so: Gracias por todo. A present goes to someone, so: El regalo es para ti (por ti would mean 'because of you').