@Missykat
- First of all, can I even set up a company in a country I do not reside in and then work for that company from Sweden?
This is the easy bit. :-) Yes, of course, you CAN! The issue is whether it's sensible to do, and what the tax implications are. In particular, you have to be careful not to fall foul of "anti-avoidance" measures as a result of using corporate entities outside your country of residence.
In terms of the EU's famous Freedom of Movement, this applies not just to EU citizens, but money (Euros), and corporate entities. Therefore, it's OK for a corporation from any EU country (Ireland, Bulgaria, Estonia, Lithuania, etc.) to do business across Europe. With one bank account, one VAT registration, etc. And, naturally, many folks prefer to operate an entity with a low corporate tax rate. And, to be clear, it's totally legal for you to be a legal/tax resident of EU country A, but own a corporation in EU country B. However, some countries do have reporting requirements in relation to such ownership.
- If so, what would the tax implications be? I.e. do I pay corporate tax in the country where my company is established and continue paying my personal income tax in Sweden?
Yes, the corporation pays corporate tax in its country of incorporation.
Yes, if you're a Swedish tax resident, you continue to pay personal income tax in Sweden.
The main tax complications:
(a) If your company makes a profit, you normally distribute the profit to the shareholders (as dividends). You need to make sure this is properly included in your personal income calculation and that taxes are properly paid (perhaps in both countries).
(b) You might think you can use non-cash compensation (executive car, company laptop/phone, private health insurance, gold-plated private pension scheme, etc.).
(c) Or, perhaps, you cunningly leave the profits in the company (undistributed). Then have the company (if you're the sole shareholder) invest them in property, gold, other companies, etc.
(d) Typically, as a freelancer, you want to be an employee of your own company, and hence receive a steady salary, and maintain your social security contributions (for public healthcare/pension). If you choose an Irish entity, you would effectively be an Irish employee, paying Irish social security and Irish income tax.
- Do I get to keep my social benefits in Sweden?
You don't lose your social benefits in Sweden if you keep paying your income tax and social security contributions there. And maybe you even retain them if you relocate elsewhere, I'm not familiar with Sweden rules.
And, actually, you might be able to make social security contributions elsewhere too. But, as above, there might be complications.
Overall, if you want to live (as now) 100% (or most) of the time in a high-tax country (i.e. Sweden) but use a low-tax corporate entity (e.g. Ireland), it's typically pretty messy, and probably not advisable.
I won't lie, some folks just go ahead and do it anyway, thinking that it's fine. And some know that it's NOT fine, and sneakily obfuscate their ownership via nominee shareholders and directors. I STRONGLY recommend you do neither! :-)
My recommended approach, if you're an independent freelancer, and happy to leave Sweden... is to adopt a new life as a modern Digital Nomad (and lots of folks do this). In this case, the first priority is to check the Swedish tax rules, and verify what you need to do in order to LOSE your Swedish tax residence. You can be without a tax residence, but, typically, it's better to get yourself a new tax residence country, in a low-tax country (probably, but not necessarily, the same country that you want to incorporate in). Then become an employee of your new company and pay tax/social security in the same country that you're tax resident in. You probably need a base there too, to be safe. Now, you can flit around Europe/World, and do business via this entity. You might even be able to go back to Sweden (depending on its rules). Usually, the main requirement is for you to spend less than 183 in any country (other than your new home base) to avoid accidentally becoming tax resident elsewhere.
There are many countries (Estonia, Cyprus, Ireland, Bulgaria) with lower corporate tax rates. But I don't think it's the only concern. As an example, Bulgaria (which I love, I'm a big fan), has a very low cost of living AND low property costs AND excellent connectivity. Paying for cheap local costs while earning high remote salary is what most digital nomads strive for! You can rent inexpensively in Bansko, the country's top ski/mountain resort, and home to many digital nomads. It's also an easy/fast country to relocate to AND has good low-cost flight connections all over Europe (if you sometimes work on-site, or just like variety). Best of all, it has very low (10%) personal AND corporate tax rates.
As for @TominStuttgart he's a very helpful and knowledgable fellow who has helped a lot of posters on these forums. So, even if you dislike his style, you can be sure that he's trying to help you! I think his message was "don't do it", and my answer was a lot longer, but not terribly different. :-) But I have given you some options if you want to.
I hope that helps. Good luck!