A laptop’s battery is pretty much the only component that can be safely removed while the device is running. However, in the case that you’re removing the battery while it’s on, make sure that the device is plugged in so as to avoid a shutdown.
First, slide the latch until you hit resistance. At this point, you have two options.
You can either keep pushing the latch until the battery pops out. . .
or you can start prying the battery out while pushing the latch (as shown in the second picture above).
Just lift the battery up and out, making sure to lift from the end near the latch.
Now the battery is out! To put it back, just insert it back in from the same angle you took it out on.