What is the best medication to take for toothache?

Depends. Until you see a dentist siple Acetaminophen or an NSAID like Motrin can be helpful. However, don;t wait too long. An abscessed tooth is not only painful but can cause a serious infection elsewhere in your body. If you are taking other medications, check with your pharmacist before using a Motrin like drug.
OTC pain meds. Take whatever you use for a headache until you can get to see your dentist, but don't delay, since your toothache will only get worse.
Best Med. Best Med is your telephone. Pills will not cure a toothache, so call your Dentist for an emergency appointment. Until you get to Dentist OTC meds taken exactly as package directs may blunt the pain, but not cure the tooth. See the Dentist ASAP.