We study the herding mechanism for the evolution of cooperation in the snowdrift game. By controlling the herding parameter a, which measures the herding behavior of players, we investigate the cooperative frequency f(c) on the payoff r. It is found that, for a small a, large clusters are formed and the system shows an intermediate level cooperation up to a big payoff r. However, as a increases, clusters become smaller, and cooperation decreases faster. When a is large, upto a critical value of about a* = 0.5, most players stay alone, each as a separate cluster, and no cooperation occurs. This phenomenon indicates that an individual favors defection, while group selection favors cooperation.