Have you ever heard a song playing on the radio or at a restaurant and thought “what song is that?” Maybe you were enjoying the music and wanted to purchase it, or maybe you despised it and wanted to put a name to the terrible tune. Shazam is a nifty app that can answer that question for you.

Shazam uses the microphone in your iPhone (or fourth-generation iPod Touch) to identify music. It works surprisingly well, even in situations where there is a lot of ambient noise. You just tap the button and wait five seconds or so for the app to record a sample, and then it will quickly upload the clip to Shazam’s servers and ID the song. If you don’t have a network connection, it will save the sample for later and offer to run the check when you have internet access.

The app will identify most of the songs you will hear on the radio, but it won’t necessarily fare quite as well with more obscure stuff. It also only works with prerecorded music; it cannot “guess” based on a live performance. For the most part, though, it will work without incident.

Shazam will keep a history of tracks you “tagged” (Shazam-speak for “identified”) so you can easily get an iTunes link and in some cases an option to play the song for free.

It’s one of those “magic” apps that is just cool. It’s kind of amazing that it’s possible, and fun to show off to your friends.

You can download Shazam for free, but you’re limited to five “tags” per month. An in-app payment of $5.99 (or simply buying the Shazam Encore app) will unlock unlimited tagging.