In present work, by in site measuring the equation of state and yield strength of tantalum boride (TaB) and tantalum diboride (TaB2) at room temperature, we have compared the bulk modulus, stress and strain of these two samples at high pressures. We found that the TaB displays a bulk modulus of 347±2.4 GPa (K′0=4), which employing the methanol-ethanol mixture as the pressure-transmitting medium. However, TaB2, which has two boron atoms, has a bulk modulus of 388±1.2 GPa (K′0=4) at the same experimental conditions. It illustrated that the bulk modulus of two boron atoms was larger than that of one boron atom in this work. Meanwhile, through the diffraction line-width analysis, the stress and strain of two samples were analyzed under high pressures. The measured yield strength data for two samples were 17.4 GPa for TaB and 21.6 GPa for TaB2 under high pressures at room temperature. The first-principles calculations show that the structures of the two samples are stable at high pressures.