Thunder" was written by Jessie J, Mikkel S. Eriksen, Tor Erik Hermansen, Claude Kelly and Benny Blanco. It was produced by Eriksen and Hermansen, credited under their production name StarGate, along with Blanco. The song was the last song Jessie and Kelly penned for the Alive album. "It got sent over by Stargate and Benny Blanco, and Claude and myself were like, 'Thunder, thunder, thunder'", Jessie later elaborated, "we just started writing and had it finished in about half an hour before I went to the airport to fly home from New York." Lyrically, "Thunder" was inspired by Jessie J's religious beliefs. "Thunder is a dedication to God," she told British newspaper The Mirror. "I remember I prayed a lot when I worked on this album and it's not something I've ever spoken about openly," she shared. "I've very much enjoyed bringing my beliefs onto the album. I think it's important that whatever your beliefs are you use them in your day-to-day life."