In order to apply for a visa at a U.S. embassy or consulate you must have the following:
Canadian citizens do not need to apply for a visa but must pay the SEVIS fee.
The expiration date on your visa may not match the end date on your I-20 or DS-2019. If your visa expires before you complete your program, you can apply for a new visa on your next trip overseas.
Renewing your F-1 and J-1 visa
Your F-1 or J-1 visa is the stamp placed into your passport for all foreign nationals (except for Canadians citizens). The I-20 or DS-2019 is the document issued by your sponsor. The sponsor of the I-20 or DS-2019 is usually Stanford Univeristy although some students may be sponsored by another institution or agency (E.g. Fulbright). See I-20/DS-2019 extension guidance for more information.
When to Renew the F-1 or J-1 visa stamp
Your I-20 or DS-2019 states the duration of your academic program, and after the completion of your program, including any post-graduation work authorization such as F-1 OPT/STEM OPT or J-1 Academic Training. If the student visa has expired and you and/or your dependents travel internationally, you most likely need to renew the student visa before re-entering the U.S. The exception to this would be Automatic Visa Revalidation which includes travel to Canada, Mexico, and the adjacent islands but foreign nationals of certain countries do not qualify.
You can only renew your student visa at an U.S. embassy abroad. To do this, you would follow the same instructions as you did when first applying for your visa (see above). If you are on an F-1 OPT/STEM OPT at the time of visa renewal, please be sure to have your Employment Authorization Document (EAD) and job offer for the visa interview. Some consulates may allow you to use a mail-in service from your home country, please inquiry about this option with the consulate or embassy at which you are seeking a visa.