Lots of recipes begin with something along the lines of "fry onions in oil until tender/soft/translucent". When I do this I often find that the onions end up burning before they have softened. What are the right things to do in order to fry them so they don't burn?
The temperature you eventually set for your your pan depends entirely on the amount of effort you are going to put into stirring the onions & the amount of patience you have before considering them 'done'.
Sweating down onions properly can take half an hour, not the 5 minutes most recipes assume you have the patience for.
Firstly, not all onions are the same - they vary in water content dramatically, so you need to modify your method to account for this.
Secondly, not all pans are the same - more modification to suit.
Thirdly, burners - you guessed it - not all burners are the same...
So, starting from that randomness,
Use a good slug or three of oil.
Heat your pan to almost smoking hot
Drop your onions
Stir & keep stirring, until the sizzle starts to fade
This gets some heat into the onion quickly but requires your constant attention.
Drop the heat to maybe ¼
Stir every couple of minutes.
If you can still hear 'crackle' drop the heat some more.
This is the difference between 'frying' & 'sweating' - if they're still crackling, they're frying; frying makes them brown [& eventually black], sweating doesn't. Sweating will eventually make them 'golden brown' which is a whole different taste.
[This is moisture- & heat-dependant, see points 1, 2 & 3 Really wet onions you have trouble getting to fry at all, dry ones will burn as soon as look at them.]
Once the onions have reached the same temperature as the pan & are no longer fully sizzling, then you can relax a bit & get on with something else.
Once you've got the water content, heat & oil combo just right, you can sweat them like this for as long as you like & they won't burn.
They will eventually caramelise, but they won't burn so long as you stir them every few minutes.
The time between those 'few minutes' depends on those three factors & your impatience to get this part over with & on to the next bit.
If you're impatient & want it done in 5 minutes, then you keep the heat up high & you keep those onions moving constantly.
The result will not be as sweet, but is a reasonable approximation.
Doing it this way, if you turn your back or even blink too long, they will burn underneath whilst still being underdone on top.
This is generally only considered even vaguely edible if you run a midnight hot-dog stand for the less-discerning diner stumbling out of a night club ;)
You may need to use a little more oil/butter, but the biggest things are to not get them too hot, and to stir them fairly often. Once they're sizzling that's hot enough. Some cookers will get keep getting hotter for quite a while, so you may need to turn them down preemptively. Heavy pans will do the same but overall tend to make gentle cooking easier. You can put a lid on with quite a gentle setting, opening the pan to stir. This makes for more even cooking, but you have to turn the heat down even lower than when not using the lid.
Recipes often imply that softening onions is quicker than is really the case, so be patient.
Top tip a chef friend shared with me. Slice the onions and place them in a bowl. Microwave for 3.5 to 4 minutes then throw them into a hot (but not crazy hot) pan with a little butter and a small splash of vegetable oil (to stop the butter from burning).
The microwaving softens the onions perfectly - all the pan is doing is adding a little colour. If you've just taken a steak off the pan, don't clean it - the onions will soak up all the flavour!
Onions at different sides of world behave differently.For eg. Red onions in Asia have these stages - translucent - golden brown - Caramalized- burned. In US Red Onions can get to translucent - change colour but not golden brown - burned. Depending on your location keep the heat to a medium and have enough fat (oil/butter) so onion is sufficiently wet when starting. Have patience and don't crank up heat cos nothing happening.
I know you picked an answer already but to give you a reference point: On my electric stove it takes about 5-10 minutes with the dial at 4/10 to soften them. I stir them about every 1-2 minutes. They will soften quicker at about 6/10 but then you've gotta stir at least every 30 seconds or they will burn (hotter = faster to burn). At 6/10 I still end up with a bit of "browning" on some bits but never a burned taste as long as they are stirred sufficiently.
Also, I only use a small splash of oil. They release enough liquid to prevent sticking that the oil is only added for better heat transfer initially rather than as an anti-stick measure. If your pans are super "sticky" then more oil may help. Butter also has a lower smoke/burn point than most oils and will burn at a lower temperature so frying with some oil and then adding butter for flavour later may help.
When I DO want to "fry" in butter, I almost "boil" them in butter. Usually butter in onions in my cooking means it is part of a roux so I'll use enough butter to fry the onions so that I don't need to add anymore for my later roux (which means the onions are in quite a lot of butter). Its TASTY but not healthy so it is only on a rare occurrence that I'll do this. Otherwise its my standard dash of olive oil.
Recipes all seem deluded with how long it takes onions to cook and even more deluded with how long it takes to caramelize them - its always longer than recipes imply.
Place onions in a shallow pan, add some salt (not much), some water and some oil (don't overdue, unless planing to do stuff with that oil after the fry). Bring to a medium boil... don't change the temperature after this. The water will boil the onions at 100C. After most of the water is gone, the temperature will climb (the onions at this time are cooked, you're aiming for color/texture), and you should start to turn them. Patience and close observation is the key. Make sure to turn all of them, everything left in place will brown out quickly! One simple way to cheat, is to fry the onions a little, to dry them out, and sprinkle some paprika. It will make the color perfect.
There's lots of ideas here, I suggest another one: Put a lid on the pan, use low heat (likely one third of what you are using) and add oil or butter. The lid unsures that some moisture of the onions stays in the pan and that appear to do the trick. Contrary to what others say you don't need, in my experience, to constantly stir the onions. Give them 5-15 minutes though.
If you want your onions dark, do the above, then take of lid and turn up the heat. IME better than starting at a high temp, the result is more even and they taste sweeter.