is there a formula to this? like looking at the chord progressions and pulling it out of that? or is there an easier way? thanks
Well generally the first chord in the song is the key but sometimes that's not quite right and you have to look at the chords and notes and see what key they fit into.
R.I.P. My Signature. Lost to us in the great Signature Massacre of 2014.

Quote by Master Foo
“A man who mistakes secrets for knowledge is like a man who, seeking light, hugs a candle so closely that he smothers it and burns his hand.”

It's often the last note in the song (the last chord is often the same as the last note, especially if it's a long note that lasts the whole measure,) but this isn't foolproof. I'm sure there's another way, but when that doesn't work, this is what I do:

1. Listen to the song. Does it sound major-y (happy) or minor-y (sad)?
2. Look at the chords.
3. Figure out what scale has those chords as it notes.

For example, if your song has G, C, D, and Em in it, it's in the key of G, because the G major scale goes like this: G A B C D E F# G. In a major key, you add, in this order: maj, min, min, maj, maj, min, dim to the end of each of the notes in the scale to know what the chords are. So, the chords in the key of G are G major, A minor, B minor, C major, D major, E minor, F# diminished. You can see that G major, C major, D major, and E minor are all in the G major scale, so your song is in G major. Minor keys are a little trickier, so let me know if you come across one. It takes me a minute to figure them out because they have more options. Hope this helps.