The invention relates to a user tag based shunt method and system in a 5G network, belonging to the technical field of communications. On the basis of a C-radio access network (C-RAN) architecture, a user tag is analyzed and extracted by a deep packet inspection (DPI) module, and a shunt strategy is deployed on an access network discovery and selection function (ANDSF), so as to realize WiFi shunt in a 5G complex heterogeneous network. The shunt method and system comprehensively consider three aspects of factors, namely, user preference, service requirements and network performances. For dense and complex distribution of WiFi in future 5G network and the heterogeneous network environment in which WiFi and 5G network are further fused, the method and system well solve the problem of WiFi shunt. The method and system mainly comprise a WiFi shunt trigger unit. An access point (AP) proactively reports or passively reports network state information. A DPI unit analyzes and acquires the user tag. The ANDSF executes the shunt strategy, ranks candidate WiFi, and starts the shunt switching process. The method and device can simultaneously satisfy service requirements and achieve the purpose of network resource dynamic match, improve the user quality of experience (QoE), balance network load, and realize benefit maximization of the user and network operators.