Trim off all the flowers, and trim it downto a neat shape, but always leave some leaves on the shoot you are cutting. Lavender will not sprout from old wood, so if you cut off too much , you will kill it. If it is very old and straggly, maybe consider starting with a new plant, or taking cuttings off of this one to replace it. Cuttings are best taken in June.
Posts