Keep it plugged in when near a socket so you keep the charging cycles down on your LiPo (lithium polymer) cells / battery, but not plugged in all the time. When not being used for several hours, turn it off and unplug it.
And best "tip" is if its near a socket,...plug it in as long as you can (especially at home) since cycle count on the battery are the "miles that wear out the tires (battery)", however again, not plugged in all or most of the time.
"Apple does not recommend leaving your portable plugged in all the time."
While cycle count is commonly seen to be the “miles” on your Lithium Ion pack cell in your Macbook, which they are, this distinction is not a fine line at all, and it is a big misconception to “count charge cycles”
*A person who has, for example, 300 charge cycles on their battery and is recharging at say 70% remaining of a 100% charge is a whole world better and different than another person who has 300 charge cycles at say 20% remaining on a 100% charge.
DoD (depth of discharge) is infinitely more important on the wear and tear on your Macbook battery than any mere charge cycle count. *There is no set “mile” or wear from a charge cycle in general OR in specific. As such, contrary to popular conception, counting cycles is not conclusive whatsoever, rather the amount of deep DoD on an averaged scale of its use and charging conditions.
*Contrary to some myths out there, there is protection circuitry in your Macbook and therefore you cannot overcharge it when plugged in and already fully charged
*However if you don’t plan on using it for a few hours, turn it OFF (plugged in or otherwise) ..*you don’t want your Macbook both always plugged in AND in sleep mode (When portable devices are charging and in the on or sleep position, the current that is drawn through the device is called the parasitic load and will alter the dynamics of charge cycle. Battery manufacturers advise against parasitic loading because it induces mini-cycles.)
Keeping batteries connected to a charger ensures that periodic "top-ups" do very minor but continuous damage to individual cells, hence Apples recommendation above: “Apple does not recommend leaving your portable plugged in all the time”, …this is because “Li-ion degrades fastest at high state-of-charge”. This is also the same reason new Apple notebooks are packaged with 50% charges and not 100%.
LiPo (lithium polymer, same as in your Macbook) batteries do not need conditioning. However...
A lot of battery experts call the use of Lithium cells the "80% Rule" ...meaning use 80% of the charge or so, then recharge them for longer overall life.
Never let your Macbook die from power, you can corrupt files that way, and the batteries do not like it.
The only quantified abuse seen to Lithium cells is instances when often the cells are repeatedly drained very low…. key word being "often"
The good news is that your Macbook has a safety circuit in place to insure the battery doesn’t reach too low before your Macbook will auto power-off. Bad news: if you let your Macbook protection circuitry shut down your notebook at its bottom, and you refrain from charging it for a couple days...the battery will SELF-DRAIN to zero (depending on climate and humidity)…and nothing is worse on a Lithium battery being low-discharged than self-draining down to and sitting at 0
Contrary to what some might say, Lithium batteries have an "ideal" break in period. First ten cycles or so, don't discharge down past 40% of the battery's capacity. Same way you don’t take a new car out and speed and rev the engine hard first 100 or so miles.
*Also, if you’re going to store your Macbook away for a few weeks or more... make sure it has at least a 50% or so charge.
Proper treatment is still important. Just because LiPo batteries don’t need conditioning in general, does NOT mean they dont have an ideal use / recharge environment. Anything can be abused even if it doesn’t need conditioning.
From Apple on batteries:
Storing your MacBook
If you are going to store your MacBook away for an extended period of time, keep it in a cool location (room temperature roughly 22° C or about 72° F). Make certain you have at least a 50% charge on the internal battery of your Macbook if you plan on storing it away for a few months; recharge your battery to 50% or so every six months roughly if being stored away. If you live in a humid environment, keep your Macbook stored in its zippered case to prevent infiltration of humidity on the internals of your Macbook which could lead to corrosion.