For a (molecular) graph, the first Zagreb indexM1 is equal to the sum of squares of its vertex degrees, and the second Zagreb index M2 is equal to the sum of products of degrees of pairs of adjacent vertices. A connected graph G is a cactus if any two of its cycles have at most one common vertex. In this paper, we investigate the first and the second Zagreb indices of cacti with k pendant vertices. We determine sharp bounds for M1-, M2-values of n-vertex cacti with k pendant vertices. As a consequence, we determine the n-vertex cacti with maximal Zagreb indices and we also determine the cactus...