Mix a carpet cleaning solution of borax, white vinegar and table salt. The amounts of the products vary depending on the size of coffee stain, but all three parts should be equal or close to equal (for example 1 cup each).
Dip the brush into the cleaning solution.
Scrub the stained carpet gently with the brush.
Repeat Steps 2 and 3 until the entire coffee stain is covered.
Leave the cleaning solution on the carpet for at least two hours. The solution can be left on the carpet overnight.
Sweep the carpet with a vacuum cleaner. Inspect the carpet and repeat if you still notice the coffee stain.