To caramelize onions, heat a pan over medium-low heat and add sliced onions with a pinch of salt. Cook them slowly, stirring occasionally, until they turn golden brown and develop a sweet flavor. This process can take around 30 minutes.