The level of seniority of a developer doesn't only depend on the years of working experience. There can be devs coding for a whole career that never get to be Senior Developers, as there can be young Senior Developers too. Let's be real: experience means expertise and it's an essential part of being Senior. However, to identify the level of seniority of devs you should also pay attention to their skills, mindset, code style and the phases of the software development cycle (SDLC) they can work on.
A Junior Dev is someone who hasn't had more than two years of practice coding. Many times they're having their first or second work experience and they're finishing their career or are recent graduates from University. They have basic knowledge of some programming languages, frameworks, tools and methodologies; but they never really applied them to the real world. They don't know how the business works, the commercial side of software and the day-to-day life of a developer. They cannot carry out a project on their own and are unable to take initiative proposing effective and efficient solutions. They need orientation, support and someone they can ask their questions to.
You can't expect good quality code from Junior Devs, they focus on developing a working code. Their objective is for the software to work, but their code may be confusing, repetitive or sloppy for others. They think in the short term: making things function. They still haven't understood the importance of good code in the long term: a code that will be easy to deal with for future and external developers.
Junior Devs have limited coding skills, but with experience and good orientation, they will easily learn technical details that end up being fundamental in the quality of the software. They require time from other team members. The team needs to understand that the time used on teaching is an inversion for the company.
A senior developer can develop a whole application from scratch by himself. Senior devs know about design patterns, architecture, automating testing, performance, security, debugging, bug fixing, testing, validation, etc. This doesn't mean they don't have questions or make mistakes, it means they know how to identify problems and where to find the right answers. That's why they are the ones who get assigned highly complicated tasks that require an exhaustive level of knowledge. Senior developers already understood that tech advances every day, so they can never stop learning, studying and professionalizing their work.
Their code is simple and clear, it's oriented to people in the long-term, junior and mid-level devs can easily understand this code. They can transform a complex requirement into a simple and intuitive code. With this clean code, bugs are easier to find and maintenance is cheaper. It’s more straightforward to test, to port to another platform, to scale up, etc. And of course, it's easier for other developers to read and work on it.
The human side is quite essential too. In order to be a Senior Dev, you need to be perfectly able to understand and communicate with clients and transform business processes into programming code. At the same time, it will be important to communicate effectively with the rest of the team. On the one hand, to designate tasks in a productive way and on the other to review and offer feedback to the other developers, serving as a mentor for Junior and Mid-Level Devs.
The Mid-Level is quite gray and has many nuances. The easiest way to define a Mid-Level Developer is by differencing them from Junior and Seniors. Unlike juniors, Mid-Level Devs take initiative on finding the right solutions to problems. They know first hand most or all of the stages of the SDLC and are technically strong in more than one area. They don't need strict supervision, they are independently productive and can operate on their own, though they may still need orientation in specific events. A Mid-Level Dev has already made mistakes, failed and learned from them, that's why they know how to avoid these traps.
Mid-Level Developers can develop software that actually does the job... Juniors can't do that on their own. The difference with Seniors is that the code isn't as clear to read for other developers. Mid-Level Devs can make a good and independent job, but Seniors are the ones that take the tasks that no one knows how to fix.
Another difference between Seniors and Mid-Levels is their mindset. Seniors can understand the project as a whole, they develop thinking in the long term, differencing a good code from a working code and taking into account the importance of optimizing the maintenance.