Full-potential linearized augmented plane-wave method with the generalized gradient approximation for the exchange-correlation potential has been applied for the comparative study of structural, elastic, and electronic properties of the synthesized non-oxide anti-perovskites: superconducting CdCNi 3 and magnetic InCNi 3 . The optimized lattice parameters, independent elastic constants ͑C 11 , C 12 , and C 44 ͒, bulk modules B, compressibility , shear modules G, and tetragonal shear modules GЈ are evaluated. The numerical estimates of the elastic parameters of the polycrystalline InCNi 3 and CdCNi 3 ceramics are performed. The band structures, total and site-projected l-decomposed densities of states, the shapes of the Fermi surfaces, the Sommerfeld coefficients, and the molar Pauli paramagnetic susceptibility for these anti-perovskites are obtained and analyzed in comparison with the available theoretical and experimental data. From our calculations, the stoichiometric CdCNi 3 and InCN 3 are very much alike in both structural and elastic properties but differ in electronic properties. For InCNi 3 , the defect-induced magnetism associated with the indium vacancies or Ni atoms substituting for In was found.