Let K be a field and let UTn(K) and Tn(K) denote the groups of all unitriangular and triangular matrices over field K, respectively. In the paper, the lattices of verbal subgroups of these groups are characterized. Consequently the equalities between certain verbal subgroups and their verbal width are determined. The considerations bring a series of verbal subgroups with exactly known finite width equal to 2. An analogous characterization and results for the groups of infinitely dimensional triangular and unitriangular matrices are established in the last part of the paper.