Lineage trees describe the microevolution of cells within an organism. They have been useful in the study of B cell affinity maturation, which is based on somatic hypermutation of immunoglobulin genes in germinal centers and selection of the resulting mutants. Our aim was to create and implement an algorithm that can generate lineage trees from immunoglobulin variable region gene sequences. The IgTree program implements the algorithm we developed, and generates lineage trees. Original sequences found in experiments are assigned to either leaves or internal nodes of the tree. Each tree node represents a single mutation separating the sequences. The mutations that separate the sequences from each other can be point mutations, deletions or insertions. The program can deal with gaps and find potential reversion mutations. The program also enumerates mutation frequencies and sequence motifs around each mutation, on a per-tree basis. The algorithm has proven useful in several studies of immunoglobulin variable region gene mutations.