"firework" was written by perry, mikkel s. eriksen, tor erik hermansen, sandy wilhelm, and ester dean while produced by stargate and sandy vee at soapbox studios in atlanta, georgia. it was recorded at roc the mic studios in new york city. it was mixed at the bunker studios by vee. audio engineering was done by carlos oyandel and damien lewis. all instruments were done by stargate and vee. lead and background vocals were provided by perry. perry said that "firework" is her favorite song on "teenage dream".