Yes, it is completely legal to set up an offshore company.
Offshore company is a company that is situated in a jurisdiction that is different from your home country. Offshore companies are frequently used by people who want to legally reduce their income tax liability or protect family assets from lawsuits. In case you are offshore company, then you would have to comply with the tax laws that apply to your locality.
These are just some of the many ways in which you can use an offshore company for tax reduction and asset protection. The best thing about offshore companies is that you can hide your personal information and identity from public view. In fact, the offshore company is required to have another layer of secrecy by not revealing any information about the beneficial owner of the company. This is something that you cannot achieve if your company is based in your home country.