The experts have spoken and this is the key to keeping your avocados in good shape.
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.
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.