Superconducting materials with a nontrivial band structure are potential candidates for topological superconductivity. Here, by combining muon-spin rotation and relaxation () methods with theoretical calculations, we investigate the superconducting and topological properties of the rocksalt-type compounds NbC and TaC (with and 10.3 K, respectively). At a macroscopic level, the magnetization and heat-capacity measurements under applied magnetic field provide an upper critical field of 1.93 and 0.65 T for NbC and TaC, respectively. The low-temperature superfluid density, determined by transverse-field and electronic specific-heat data, suggest a fully gapped superconducting state in both NbC and TaC, with a zero-temperature gap and 1.45 meV, and a magnetic penetration depth and 77 nm, respectively. Band-structure calculations suggest that the density of states at the Fermi level are dominated by the Nb (or Ta ) orbitals, which are strongly hybridized with the C orbitals to produce large cylinderlike Fermi surfaces, similar to those of high- iron-based superconductors. Without considering the spin-orbit coupling (SOC) effect, the first Brillouin zone contains three closed node lines in the bulk band structure, protected by time-reversal and space-inversion symmetry. When considering SOC, its effects in the NbC case appear rather modest. Therefore, the node lines may be preserved in NbC, hence proposing it as a potential topological superconductor.