Topical anesthetics work by blocking the sodium channels in nerve cells. This prevents the transmission of pain signals to the brain, thereby providing relief. The onset of action can vary depending on the type of anesthetic used, but it generally takes a few minutes to start working.