Peeling an onion removes the dry, papery outer layer, resulting in a milder, sweeter flavor and a more tender texture compared to including that layer in your cooking. The outer layer can impart a slightly bitter and tougher texture.
The outermost layer of an onion is primarily a protective layer, designed to shield the inner layers from damage and dehydration. This layer tends to be drier and less hydrated than the inner layers. Consequently, it contains a higher concentration of certain sulfur compounds that contribute to a sharper, more pungent, and sometimes slightly bitter flavor. When cooked, this outer layer can also remain tougher and less likely to fully soften compared to the more tender inner layers.
When you peel an onion, you are removing this protective layer and exposing the more hydrated and sweeter inner layers. These inner layers have a higher water content and a lower concentration of the harsher sulfur compounds. As a result, cooking with peeled onions generally yields a milder, sweeter flavor and a more uniformly tender texture. The difference is subtle but noticeable, especially in dishes where the onion flavor is prominent.
If you're making a stock or broth, including the clean outer layers of the onion can add depth of flavor and color. However, for dishes where you want a sweeter, milder onion flavor, always peel the onion completely.