Yes, you can substitute leeks for onions in many recipes. However, keep in mind that leeks have a milder and sweeter flavor compared to onions. It's best to use both the white and light green parts of leeks to achieve a similar taste.