Question: Most of the time in all the Spanish speaking countries I've been in I've heard ***de nada*** as the reply to *gracias* or the equivalent of English *you're welcome* etc.

But after a while I became conscious that sometimes some people were instead saying ***por nada***.

Are they actually used in different grammatical situations? Does the *de* vs *por* depend on something in the topic of what the thanking was about?

Or is it purely up to how the speaker feels, or is one more prevalent in certain places? Or is one less formal or not condoned as official by the RAE?

Answer: 
*De nada* is usually used as a polite answer after *Gracias*. On the other side *Por nada* is used when you were working on something and you didn't have a result, so you were working for nothing. In my opinion, *Por nada* would be then impolite answer after *Gracias*!

Also, direct translate of the phrases would be:

> 
> De nada = You're welcome
> 
> 
> Por nada = For nothing.
> 
> 
>
Por nada is more like saying "no problem" than "your welcome", so its a less formal response.