Abstract-We propose a branch flow model for the analysis and optimization of mesh as well as radial networks. The model leads to a new approach to solving optimal power flow (OPF) problems that consists of two relaxation steps. The first step eliminates the voltage and current angles and the second step approximates the resulting problem by a conic program that can be solved efficiently. For radial networks, we prove that both relaxation steps are always exact, provided there are no upper bounds on loads. For mesh networks, the conic relaxation is always exact and we characterize when the angle relaxation may fail. We propose a simple method to convexify a mesh network using phase shifters so that both relaxation steps are always exact and OPF for the convexified network can always be solved efficiently for a globally optimal solution. We prove that convexification requires phase shifters only outside a spanning tree of the network graph and their placement depends only on network topology, not on power flows, generation, loads, or operating constraints. Since power networks are sparse, the number of required phase shifters may be relatively small.