A cyclobutane pyrimidine dimer (CPD) is a photolesion which is produced by a cycloaddition reaction between two stacked pyrimidine bases upon UV light absorption. Because of its harmful effect on important cellular processes involving DNA and especially its relevance to skin cancer, the mechanisms of how a CPD is formed or repaired have been studied extensively, and it has been demonstrated that flanking nucleotide sequences play a crucial role in CPD formation or self-repair. Understanding the mechanisms behind this sequence dependence of CPD formation or self-repair is of great importance because it can give us valuable information on which sequence will be vulnerable to this DNA photodamage. This Perspective focuses on the mechanisms of how flanking nucleotide sequences affect CPD formation or self-repair, especially highlighting the role of computational studies in this field.