Photolithography is a key process used in the semiconductor industry during the fabrication of integrated circuits. It is the process in which a given circuit layout pattern is transferred onto a substrate by employing a mask. The role of the mask is to block out the ultraviolet light exposure on certain areas on the substrate, hence allowing the emergence of specific patterns after chemical post-processing. Designing the perfect mask that takes into account all optical effects, especially at nanometer resolutions, is a challenging task. In this thesis, we formulate this as an inverse problem, i.e. finding the mask that produces the desired pattern. In order to do this, we first introduce the forward problem of calculating the light intensity at the substrate, given the initial mask. We then formulate a variational problem, which minimizes the mismatch between the desired mask and the one predicted by the model. The variational problem is solved using a level-set approach. Our results show that we can successfully produce masks that match the desired patterns with an error less than 2%. We believe our algorithm can enable further automation of the mask design process, and help manufacturers design better layouts at nanometer scales.