It's no secret that avocados are delicate, and the flesh of a ripe avocado can quickly change color after it's been cut, from a gorgeous green to a kind of icky brown. That change in color is a result of oxidation, the chemical reaction that occurs when an avocado is exposed to air, and it's not a good look. It also doesn't taste good. The experts at the Hass Avocado Board don't recommend eating the parts of the avocado that have oxidized or turned brown. The good news is that you can still salvage your browned guacamole or avocado toast, assuming only the top layer has changed color and "the underneath is green." All you have to do is skim off the brown bits, revealing the green avocado you know and love.
But the best way to avoid eating browned avocados is to prevent oxidation in the first place, and there are a couple of easy ways to stop cut avocados from turning brown. The first, according to Harold McGee in On Food and Cooking: The Science and Lore of the Kitchen, is to add an acid to the avocado, like lime or lemon juice. This technique works because acid prevents the enzymes that cause the browning from working properly, and it's a great option for mashed avocados and guacamole.
You can also prevent oxidization by blocking the avocado's exposure to oxygen with plastic wrap. The trick to making this work properly is to ensure sure that the wrap is tightly surrounds the flesh of the avocado so no air can get in. "In the case of mashed avocado, this means pressing the wrap directly into the surface," notes McGee, not just wrapping the bowl and leaving a pocket of air between the plastic and the avocado—because there's still oxygen in that little air pocket that'll cause browning.
This plastic wrap solution works especially well for halved avocados, especially those with the pit still in it. That's because the pit will act as a natural barrier against oxidation, so if you're only using half of an avocado at once and saving the rest for later, wrap up the half with the pit inside.
There are other hacks out there that people swear by to keep an avocado fresh, like storing it with cut onions or brushing the flesh with olive oil. But really, keeping an avocado from getting brown means keeping it away from air, and as long as you keep that advice in mind, you'll be better prepared to stave off the discoloration.