The current power grid is no longer a feasible solution due to ever-increasing user demand of electricity, old infrastructure, and reliability issues and thus require transformation to a better grid a.k.a., smart grid (SG). The key features that distinguish SG from the conventional electrical power grid are its capability to perform two-way communication, demand side management, and real time pricing. Despite all these advantages that SG will bring, there are certain issues which are specific to SG communication system. For instance, network management of current SG systems is complex, time consuming, and done manually. Moreover, SG communication (SGC) system is built on different vendor specific devices and protocols. Therefore, the current SG systems are not protocol independent, thus leading to interoperability issue. Software defined network (SDN) has been proposed to monitor and manage the communication networks globally. By separating the control plane from the data plane, SDN helps the network operators to manage the network flexibly. Since SG heavily relies on communication networks, therefore, SDN has also paved its way into the SG. By applying SDN in SG systems, efficiency and resiliency can potentially be improved. SDN, with its programmability, protocol independence, and granularity features, can help the SG to integrate different SG standards and protocols, to cope with diverse communication systems, and to help SG to perform traffic flow orchestration and to meet specific SG quality of service requirements. This article serves as a comprehensive survey on SDN-based SGC. In this article, we first discuss taxonomy of advantages of SDNbased SGC. We then discuss SDN-based SGC architectures, along with case studies. Our article provides an in-depth discussion on routing schemes for SDN-based SGC. We also provide detailed survey of security and privacy schemes applied to SDN-based SGC. We furthermore present challenges, open issues, and future research directions related to SDN-based SGC. Index Terms-Software defined network (SDN), smart grid (SG), advanced metering infrastructure (AMI), renewable energy resources (RERs), home area networks (HANs), network management.