Nudges, which are interventions that do not restrict choice, have become widespread in economic analysis and policy. I develop a general and tractable framework to analyze the welfare implications of nudges. In this framework, individuals suffer from internalities (their utility when choosing is different from their welfare-determining utility) and choice and welfare depend on the environment, which can be altered by the nudge. I show that, in order to design the optimal nudge, no knowledge of environment-independent preferences is required. This means that the social planner does not need to fully recover individual preferences (something which is especially difficult in the presence of internalities). In heterogeneous populations, the optimal nudge trades off correcting the internalities of biased individuals with psychological costs imposed by the nudge on all individuals. When taxes are also available, nudging is generally optimal as long as the government is not fully efficient in collecting revenue from taxation. I also analyze phishing, when firms change the environment to take advantage of consumers’ internalities. Competition does not necessarily reduce phishing and, when firms have incentives to phish, competition can be welfare-decreasing. I analyze nudging and phishing in general equilibrium, and characterize the optimal nudge. Unlike recent empirical work, which finds that nudging can backfire in general equilibrium because firms raise prices in response to a nudge, I show that under perfect competition nudging is generally welfare-enhancing.