While some species of ants die with hydrogen peroxide, some studies found that some rare species drink hydrogen peroxide to heal themselves.  Therefore, it’s not a recommended solution to deter ants. Instead, you may use coffee grounds, soapy water, and other homemade solutions to control ants.