If you hold an F-1 or M-1 student visa in the U.S., you are free to travel in and out of the United States as long as the program end date on your SEVIS I-20 has not passed, your visa has not expired, and you have not done anything to fall out of student status. In fact, Canadian students do not need a formal student visa at all, only a SEVIS Form I-20.
Your trip outside the U.S. must be limited in length, however. Foreign students cannot be away for more than five months without being terminated from their program. If this happens, the DSO at your school must issue you a new I-20 form and you must apply for a new visa as an initial student.
If you know you are going to be traveling for more than five months and it's for family and/or personal reasons, discuss this with your DSO before you leave to see if you are eligible for a leave of absence. If you are, your status will not be terminated.
Before you leave the United States, take care of a few important things. First, make sure you have a valid travel signature on your I-20. The travel signature is on page three of your I-20 and is generally good for one year. If your travel signature has expired, or will expire before you return to the United States, you must visit your DSO and get a new one.
It is also a good idea to make sure the content on your I-20 is still valid. If anything has changed, let your DSO know so he or she can issue you a new I-20.
Next, photocopy your I-94 card, or if your I-94 was automated (which will be true for many U.S. visitors beginning in spring 2013), print out a copy of your online record. Take both the original and a copy or two with you. Also, make sure the student visa stamped in your passport (if you got one in the first place) has not expired. If it has, don’t panic; this doesn’t mean you have violated your status. However, plan on making a trip to your local U.S. consulate before returning to the U.S., to obtain a new visa for readmission. If you never got a visa, but became a student through a Change of Status in the United States, you will also have to visit the U.S. consulate in your home country to obtain a visa.
To return to the United States, the items you’ll present at the U.S. port or border should include your:
If your passport has expired but it contains your still-valid student visa, bring your old passport as well as your new one. And if you have forgotten something, ask to be admitted to the U.S. anyway. The border officer can give you 30 days in which to give USCIS whatever is missing.
NOTE: You can’t leave the U.S. and come back during your “grace period.” At the very end of your studies, your I-20 will probably still have some time left on it. Your program end date is just an estimate. Your grace period will start once you complete your program requirements, even if your I-20 program end date is later. When you are in your grace period, you are expected to pack your bags and get ready to leave the United States, or apply for a change of status, which will require you to stay in the country until approved. If you leave before the end of that period, you will not be able to use the same visa and I-20 to come back in, even if the date on your I-20 hasn’t yet passed.
For more information relevant to your current situation, see "Life in the U.S. on a Student or Exchange Visitor Visa."