Current actigraphic sleep/wake detection algorithms have predominantly been validated against polysomnography, although the accuracy of such validations is dependent on the degree to which the timestamps of these two methods of data collection are synchronised. We created and validated an algorithm to temporally align actigraphy and polysomnography data using a sample of 100 healthy young adults, recruited from a pool of participants in the Western Australian Pregnancy Cohort (Raine) Study. Each participant underwent one night of polysomnography with simultaneous wrist actigraphy (Actigraph GT3X+). Our alignment algorithm incorporates the raw acceleration data and considers the best alignment when the sum of the products of acceleration and polysomnography values are maximised. Segments of the night of various lengths and locations were considered as input values in addition to several values for the maximum allowable discrepancy. The optimal input values were determined by comparing accuracies, sensitivities and specificities calculated from two commonly used sleep/wake classification methods, and then validated using a simulation study. Validation suggested that our alignment algorithm can successfully align polysomnography and actigraphy timestamps. This allows for more accurate and detailed actigraphic sleep/wake detection algorithms to be created, thus strengthening the use of actigraphy as an appropriate method for sleep detection.