When black lines occur vertically in the nail, they are called longitudinal melanonychia, which is a condition caused by an overproduction of melanin. Similar to moles found on the skin, these lines are no cause for concern. This condition is more common among people who have dark skin.
Rarely, black lines may be caused by a subungual melanoma or cancer. For this reason, it's very important to have any suspicious lines looked at by a medical professional, especially if there is a family history of melanoma. Lines that change or spread into the cuticle or nail fold should also be treated with suspicion.