If you are intending to stay in Sweden for less than three months, you will need a visa if the country that issues your passport is on this list [PDF file]. You should also confirm possible visa requirements with the Swedish consulate or embassy responsible for your home country.
If your studies in Sweden will take longer than three months, you will need a residence permit before arriving in Sweden. Permits are issued by the Swedish Migration Board, and the Board has collected what you need to know before applying for a residence permit. Applications are to be made at a Swedish consulate or embassy.
Please note that you cannot apply for a residence permit unless you have been admitted to full time accredited university studies in Sweden. This includes paying the first installment of tuition fees. The application fee, which is not refundable, is SEK 1,000.
When applying for a residence permit, you must prove to the Swedish Migration Board that you will have a guaranteed sum of money at your disposal throughout the entire period of your studies. The amount, SEK 7,300 per month for ten months of the year, is set by the Migration Board. If you wish to bring your family you must show that you have at your disposal an additional SEK 3,500 per month for your spouse and SEK 2,100 per child and month. Remember that you also need to pay the first installment of tuition fees before applying for a residence permit.
If you can prove to the board's satisfaction that that you will receive free lodging during the whole or part of your study period this sum will be correspondingly reduced. Students who have been awarded a scholarship through the Swedish Institute or another program should supply proof of this. You will also need to show a valid passport and a letter of admission from the institution at which you will be studying. To be sure of obtaining your permit in time you should submit your application 6-8 weeks prior to your departure for Sweden.
Please note that residence permits are limited to the duration of the study period, or to one year, whichever is shorter. Your permit will be renewed annually, provided you receive the number of credit points required and can produce evidence of continued financial support. Renewal requests are processed by your local Swedish Migration Board office. If you have any questions please contact the Swedish embassy or consulate in your home country or country where you currently live. You can also contact the Swedish Migration Board. Also, make sure you have adequate medical insurance.
If you are a citizen of a non-Nordic EU/EEA country you have the right to reside in Sweden. The term "right to reside" means that an EU/EEA citizen is permitted to stay in Sweden for more than three months without a residence permit. However, you must register with the Migration Board no later than three months after entering the country.
To register, you must enclose proof of enrollment for a course or program which is at high school level at the minimum, assurance that you have sufficient funds for your upkeep, and proof that you have comprehensive medical insurance valid in Sweden. You can read more about the requirements for registration at the Swedish Migration Board's website. They have collected what you need to know.
Please note that if you are a citizen of Switzerland you must apply for a residence permit (see above).
Citizens from Nordic countries do not need a visa or residence permit to study in Sweden.
More information about Studying in Sweden can be found here.