Transition-metal light-element compounds are potential candidates for hard materials. In the past, most of studies focused on the binary transition metal borides, carbides and nitrides, while the researches of ternary phases are relatively rare. In this paper, the structure units of the known Nb
3B
3C and Nb
4B
3C
2 phases are first analyzed to be Nb
6C octahedron and Nb
6B triangular prism, respectively. By stacking the Nb
6C octahedron and Nb
6B triangular prism, twenty ternary Nb-B-C and twenty ternary Ta-B-C configurations with different compositions are constructed. The chemical formula of these Nb-B-C and Ta-B-C configurations can be defined to be Nb
(m + n + 2)B
(2m + 2)C
n and Ta
(m + n + 2)B
(2m + 2)C
n, respectively. Using first-principles density functional calculations, thermodynamical, dynamical and mechanical stabilities of the constructed ternary Nb-B-C and Ta-B-C configurations are investigated through calculating their enthalpies of formation, phonon dispersions and elastic constants. Five Nb-B-C (Nb
3B
3C, Nb
4B
3C
2, Nb
6B
4C
3, Nb
7B
4C
4 and Nb
7B
6C
3) phases and six Ta-B-C (Ta
3B
3C, Ta
4B
3C
2, Ta
6B
4C
3, Ta
7B
4C
4, Ta
7B
6C
3 and Ta
3BC
2) phases are predicted to be stable by analyzing the constructed ternary Nb-B-C and Ta-B-C phase diagrams, in which the seven phases (Nb
6B
4C
3, Ta
3B
3C, Ta
4B
3C
2, Ta
6B
4C
3, Ta
7B
4C
4, Ta
7B
6C
3 and Ta
3BC
2) are first predicted to be stable. The Nb
6B
4C
3, Ta
6B
4C
3, Ta
4B
3C
2 and Ta
3B
3C phases are stable when temperature is higher than 1730, 210, 360 and 1100 K, respectively. And the Ta
3BC
2 phase is stable only when temperature is lower than 130 K. The calculated results about mechanical and electric properties show that these Nb-B-C and Ta-B-C phases are conductive materials with a high hardness in a range of 23.8–27.4 GPa.