There is no site that does it in the browser, but you can absolutely build one yourself — you just download a tool first.
GameMaker is the traditional pick for this kind of project, and it is available from YoYo Games. It handles 2D platformers well and has a large community, which means most problems you hit have already been answered somewhere.
Scratch is worth trying first if you have never programmed, and Godot is a strong free option once you want more control.
One important caveat: Sonic is Sega's intellectual property. Making a fan game privately to learn is one thing, but publishing or distributing it is an infringement, and it is the reason fan projects in this space so often receive takedown notices. Build your own character if you plan to share the result.