We classify up to isomorphism all gradings by an arbitrary group G on the Lie algebras of zero-trace upper block-triangular matrices over an algebraically closed field of characteristic 0. It turns out that the support of such a grading always generates an abelian subgroup of G.Assuming that G is abelian, our technique also works to obtain the classification of G-gradings on the upper block-triangular matrices as an associative algebra, over any algebraically closed field. These gradings were originally described by A. Valenti and M. Zaicev in 2012 (assuming characteristic 0 and G finite abelian) and classified up to isomorphism by A. Borges et al. in 2018. Finally, still assuming that G is abelian, we classify G-gradings on the upper block-triangular matrices as a Jordan algebra, over an algebraically closed field of characteristic 0. It turns out that, under these assumptions, the Jordan case is equivalent to the Lie case.2010 Mathematics Subject Classification. Primary 17B70, secondary 16W50, 17C99.