All-inorganic halide double perovskites (HDPs) attract significant attention in the field of perovskite solar cells (PSCs) and light-emitting diodes. In this work, we present a first-principles study on structural, elastic, electronic and optical properties of all-inorganic HDPs Cs2AgBX6(B = In, Sb; X = F, Cl, Br, I), aiming at finding the possibility of using them as photoabsorbers for PSCs. Confirming that the cubic perovskite structure can be formed safely thanks to the proper geometric factors, we find that the lattice constants are gradually increased on increasing the atomic number of the halogen atom from F to I, indicating the weakening of Ag–X and B–X interactions. Our calculations reveal that all the perovskite compounds are mechanically stable due to their elastic constants satisfying the stability criteria, whereas only the Cl-based compounds are dynamically stable in the cubic phase by observing their phonon dispersions without soft modes. The electronic band structures are calculated with the Heyd–Scuseria–Ernzerhof hybrid functional, demonstrating that the In (Sb)-based HDPs show direct (indirect) transition of electrons and the band gaps are decreased from 4.94 to 0.06 eV on going from X = F to I. Finally, we investigate the macroscopic dielectric functions, photo-absorption coefficients, reflectivity and exciton properties, predicting that the exciton binding strength becomes weaker on going from F to I.