Our received theories of self-deception are problematic. The traditional view, according to which self-deceivers intend to deceive themselves, generates paradoxes: you cannot deceive yourself intentionally because you know your own plans and intentions. Non-traditional views argue that self-deceivers act (sub-)intentionally but deceive themselves unintentionally and unknowingly. Some non-traditionalists even say that self-deception involves a mere error (of self-knowledge). The non-traditional approach does not generate paradoxes, but it entails that people can deceive themselves by accident or by mistake, which is rather controversial. I argue that a functional analysis of human interpersonal deception and self-deception solves both problems and a few more. According to this analysis, my behavior is deceptive iff its function is to mislead; I may but need not intend to mislead. In self-deception, then, the self engages in some deceptive behavior and this behavior misleads the self. Thus, while it may but need not be intended, self-deception is never an accident or a mistake.