The World Health Organization recommends that babies are exclusively breastfed for the first six months of life. That means breastmilk only (no water as is practiced in some countries, this is unnecessary), and feeding on demand whenever the baby asks for milk. This recommendation comes from the fact that breast milk is the best nutrition for young babies, and that a baby's guts are ready for introducing solid foods at around six months of age. The WHO also recommends breastfeeding alongside solids until two years old, and for as long as mutually desired by mother and baby after that.
Breastfeeding for two years is, of course, a rarity in the west. The idea that if a baby can walk and talk, she is too old to nurse, still prevails. If you have the desire to continue nursing your toddler, the WHO's recommendation should do enough top give you the confidence that that is totally fine, though! I personally nursed my oldest child until she was 18 months old, and my son until he self-weaned at two years and a few months.
Breastfeeding continues to provide nutrition and comfort to children past the infant stage, and it was great to have instant comfort and a nice snack always ready for my young toddlers, wherever we went. Having said that, if you are a mother who wants to wean at six months, or a year, or 18 months that is your decision and nobody else's. How long should you continue to breastfeed? A simple answer may exist after all; for as long as you can, and as long as you want to.