We propose optimization as a general paradigm for formalizing welfare-based fairness in AI systems. We argue that optimization models allow formulation of a wide range of fairness criteria as social welfare functions, while enabling AI to take advantage of highly advanced solution technology. In particular, we highlight that social welfare optimization supports a broad perspective on fairness motivated by general distributive justice considerations. We illustrate this advantage by reviewing a collection of social welfare functions that capture various concepts of equity. Most of these functions have tractable optimization formulations that can be efficiently solved by state-of-the-art methods. To further demonstrate the potentials of social welfare optimization in AI, we show how to integrate optimization with rule-based AI and machine learning, and outline research directions to explore for practical implementation of integrated methods.