Eighteen-volt batteries are actually multiple low-voltage batteries wired in series to produce 18 volts. The ability to resurrect an 18-volt battery depends on the type of cells the battery pack contains. If the cells are nickel cadmium or nickel metal hydride it's likely they can be resurrected. But if the pack contains lithium ion or lithium polymer cells, there is little you can do and the best option is to purchase a replacement.
Look on the battery pack label to determine if the cells are nickel-based or lithium-based. It will say "NiCd," "NiCad" or "NiMH" if they're nickel-based and "Li-Ion" or "LiPo" if they're lithium-based. Only attempt to resurrect the pack if it contains nickel-based cells.
Recharge the 18-volt battery even if the battery appears not to take a charge. You need to start with the highest charge possible to resurrect the battery pack.
Remove the battery from the charger once the charger indicates the battery is full.
Put the battery into the device it operates. Batteries that produce 18 volts inevitably operate power tools and, as they are motorized, it's sensible to put the power tool into a small vice so it's held in place. Otherwise you must hold the tool during the resurrection process, which can be tedious.
Put a cloth around the handle of the power tool to protect it while it is clamped in the vice. Open the vice and place the handle of the tool into the jaws. Slowly close the jaws so they tighten onto the handle. Don't tighten too much, but make sure the tool is secure.
Turn on the power tool. Let it operate continuously. After a while you find the motor starts to slow, but keep it running until it completely stops.
Turn off the power switch once the motor stops. The battery and the tool will be quite hot, so let it cool down for 30 minutes or until it feels cool. The procedure of continuously running the power tool and the warmth generated starts to break down the nickel crystals in the cells. This lets them release more energy and enables them to retain more power once the process is complete.
Be sure the power tool is still secure in the vice. Turn on the tool and allow it to operate until it stops as before. It does not take very long this time. The crystals are breaking down each time you restart your power tool.
Turn off the power tool once it stops operating. Leave it for a few minutes and then repeat the process. Continue to repeat the process until you find it does not operate at all. This means the battery is completely discharged; the crystals have broken down and can now retain more energy.
Remove the power tool from the vice. Remove the battery and place the battery in the charger. Turn on the charger and let it charge the battery until it indicates it's full. Be prepared to wait longer than you have done for some time. The longer it takes to charge the better the resurrection process is.
Turn off the charger once the battery is charged and remove the battery from the charger. Don't leave batteries in chargers as they can start to discharge even though they are not in use. Put your resurrected battery into the device it powers when you want to use it.