PurposeThis study aims at exploring the nexus between herding behavior and the spillover effect in G7 and BRICS stock markets.Design/methodology/approachThe authors used the dynamic connectedness approach TVP-VAR model of Antonakakis et al. (2019) to capture the spillovers across different markets. Moreover, to explore herding behavior, the authors used a modified version of the CSAD measure of Chang et al. (2000) including extreme market movements. Finally, to study the link between these two phenomena, the authors estimated a DCC-GARCH model.FindingsThe results show that herding behavior exists in the American market and some BRICS markets. Furthermore, spillover between G7 and BRICS increases in times of crisis. Moreover, the authors find a dynamic conditional correlation between herding behavior and spillovers both in the short and long run. The authors conclude that in times of crisis, the transmission of shocks between markets is more frequent, fuelling uncertainty and pushing investors to suppress their own beliefs and follow the general market trends.Originality/valueThis paper uses the TVP-VAR model to explore the spillover effect and the DCC-GARCH model to explore the connectedness between herding behavior and the spillover effect in G7 and BRICS countries in both the short and long run.