You Can Leave Your Hat On was written by Randy Newman and appeared on his 1972 album Sail Away. It was made famous by Joe Cocker when featured in the 1986 Adrian Lyne film 9½ Weeks during the famous striptease scene. It first appeared on his album from that year titled Cocker.
In the lyrics, the singer is addressing a sexual partner as he/she disrobes as a prelude to a sexual encounter, perhaps in a striptease fashion. The vocalist in most recordings of the song is male, and is presumably addressing a female, due to the lyrics "Take off your dress."
The verses of the song are short, and the frequently repeated chorus consists simply of the line "You can leave your hat on" repeated three times, implying that the singer is aroused by his sexual partner wearing a hat, or perhaps the specific hat that she is currently wearing.