Software engineers get paid anywhere from $60,000 to $120,000. Why so much? Or why so little? Here is why:

If we look at a software engineer’s salary as a journey of many steps, at every step we’ll see that where you are, what you do, what you value most, and when you join the company determines your salary according to recent research by Startup Compass.

How can you get paid the most?

Before we dive into the statistics, let’s see what kind of a software engineer would get paid the most. Let’s call our hypothetical engineer Alex.

When Alex chooses the programming language to learn, she should go for the less user-friendly and hard to learn ones. C++ is the best. She should also focus on programming the backend.

Become the CTO, right away

Next, Alex should aim for being a CTO or VP of Engineering as soon as possible. Being an architect would be the next best thing.

But being a CTO right away is ambitious, unless Alex heads to work in a startup. Luckily, startups tend to pay more than the other two options – traditional IT firms and freelancing. Being the CTO of a startup from day 1 is possible, as long as Alex is really good.

Now that we know Alex is looking to work in a startup, how big should the startup be? Ideally, 51-100 people.

Does it matter that Alex does not yet have experience? Yes. Her salary will rise significantly after 6 years. It will go up almost twice once she has 20 years of experience.

But salaries changes thanks to raises. Alex would likely get a significant raise after the third year. So it makes sense to stay at the startup at least that long.

Just money or a piece of the pie?

But Alex might see more meaning in her work than just getting money. She might be interested in getting a piece of the company she works for – equity. Here, she will have to sacrifice a little. As the CTO, she will get around 13% of the company and about $96,000. Were she a VP of Engineering, she could get 2% of the company instead and take home $120,000.

So at what stage should Alex join a startup? Her salary will be the lowest at a startup with no funding or seed funding. If she wants a higher salary, she should wait until the startup raises their series B round of funding. Of course, by the time series B comes around there will probably be another CTO at the startup. But that CTO could leave, so joining a well-funded startup as the CTO is still possible, but at that point there will be less equity to go around.

All startups can be divided into consumer product oriented ones and enterprise oriented ones. While building things for consumers might be more exciting, the enterprise oriented startups tend to pay more. So Alex should be looking at startups that describe themselves as “SaaS”, “B2B”, “platform.” If that sounds too boring, there are always more consumer startups out there.

Lastly, there are many kinds of a software engineer Alex could be, aside from her CTO title. The highest-paid kind would be a software architect. The next best thing would be a data scientist.

By now Alex probably realizes that the advice on how to get a higher salary is conflicting. By now she may wonder whether getting the highest salary is less important than her freedom to choose a less popular programming language, to get more equity in a company, or to become a different kind of software engineer. She will have some deciding to do.

Where did we get this data?

In October 2014, Startup Compass conducted a Tech Salary survey of the engineering community from around the world to gather data on salary and equity. They included basic salary information from different countries, roles and skills as well as technologies from other sources such as Elance-oDesk, Toptal, Glassdoor, Angellist and Payscale.