The basic goal of this paper is to provide a formal treatment of "orthographic principles" in terms of optimization. Starting from a discussion of a preference-oriented vs. a rule-oriented systematic theory of orthography, the paper explores an explicit description of orthographic regularities in terms of Optimality Theory, that is, in terms of a theory of constraints and their interaction. The empirical focus of this paper is on German orthography, in particular on sound-letter correspondences, on morphological constancy in the light of phonological alternations, and on the (non-)doubling of graphemes. Interactions of various constraints to specify the relationship between regular and irregular spellings involving these domains on the one hand and phonological forms on the other hand are presented.