Introduction
Phylogenetic trees are one of the most useful ways to visualize evolutionary relationships among biological sequences. They can help researchers investigate how organisms are related, compare genes across species, study pathogen diversity, and explore the evolutionary history of proteins and genomes.
One of the most widely used tools for building phylogenetic trees from sequence alignments is FastTree.
FastTree is designed to infer approximately maximum-likelihood phylogenetic trees from nucleotide or protein sequence alignments. Its major advantage is speed: it was developed specifically to make phylogenetic analysis practical for large alignments containing thousands or even hundreds of thousands of sequences. The current FastTree documentation describes FastTree 2.2 as capable of handling alignments with up to approximately one million sequences under suitable conditions.
In this guide, we'll walk through what FastTree does, what you need before using it, how to run a basic analysis, how to interpret the resulting tree, and where FastTree fits within the broader landscape of computational phylogenetics.
What Is FastTree?
FastTree is an open-source command-line program for inferring phylogenetic trees from multiple sequence alignments.
It accepts aligned nucleotide or protein sequences and produces a phylogenetic tree, typically in Newick format.
At a high level, the workflow looks like this:
Raw sequences
β
Multiple sequence alignment
β
FastTree
β
Phylogenetic tree
β
Tree visualization and interpretation
The important thing to notice is that FastTree expects an alignment as input. It is therefore an alignment-based phylogenetic tool.
This makes FastTree particularly useful when your research workflow already includes a high-quality multiple sequence alignment.
Why Is FastTree Useful?
Building a phylogenetic tree can become computationally expensive as the number of sequences increases.
A dataset containing 20 sequences is relatively easy to analyze. A dataset containing 20,000, 100,000, or more sequences presents a very different computational problem.
FastTree was designed to address this challenge by using a series of heuristics and tree-search strategies that make large phylogenetic analyses substantially faster than many traditional maximum-likelihood implementations.
According to the FastTree documentation, the program combines heuristic neighbor joining, minimum-evolution tree rearrangements, maximum-likelihood optimization, and local support calculations.
The result is a practical compromise between computational speed and phylogenetic inference.
What Do You Need Before Running FastTree?
The most important requirement is a multiple sequence alignment.
For example, suppose you have five DNA sequences:
>Sequence_A ATGCGTACGATCGATCG >Sequence_B ATGCGTACGATCGATCA >Sequence_C ATGCGTACGATGGATCA >Sequence_D ATGCGTACGTTGGATCA >Sequence_E ATGCGTACGTTGGATCG
These sequences would first need to be aligned so that homologous positions occupy corresponding columns.
A simplified alignment might look like:
>Sequence_A ATGCGTACGATCGATCG >Sequence_B ATGCGTACGATCGATCA >Sequence_C ATGCGTACGATGGATCA >Sequence_D ATGCGTACGTTGGATCA >Sequence_E ATGCGTACGTTGGATCG
The alignment itself is not produced by FastTree. You normally use a separate alignment program such as MAFFT, MUSCLE, or another appropriate alignment method before running FastTree.
Installing FastTree
FastTree provides precompiled executables for several platforms, including Linux and Windows, while the source code can also be compiled for other systems.
The official FastTree documentation provides installation instructions and downloadable versions:
FastTree Official Documentation β
On Linux or macOS, the executable may be run from the terminal. Depending on how it was installed or compiled, you may need to specify the executable path explicitly.
For example:
./FastTree
Running FastTree without arguments or using the help option displays information about the installed version and available parameters.
FastTree -help
Your First FastTree Analysis
Let's start with the simplest possible example.
Assume that you have an aligned FASTA file called:
sequences.fasta
For a basic nucleotide analysis, you can run:
FastTree -nt sequences.fasta > tree.nwk
This command tells FastTree to interpret the input as nucleotide sequences and writes the resulting tree to:
tree.nwk
The > operator redirects the output from the terminal into the specified file.
For example:
FastTree -nt sequences.fasta > my_phylogeny.nwk
After the command finishes, you should have a Newick-format tree that can be opened using a compatible tree visualization program.
Using the GTR Model
FastTree can also infer nucleotide trees using the generalized time-reversible model, commonly referred to as GTR.
A basic command is:
FastTree -nt -gtr sequences.fasta > tree.nwk
Here:
-nttells FastTree that the sequences are nucleotide sequences.-gtrrequests the GTR model.sequences.fastais the aligned input.> tree.nwkwrites the tree to a Newick file.
FastTree's documentation notes that without -gtr, nucleotide analyses use the Jukes-Cantor model by default.
What About Protein Sequences?
FastTree can also analyze protein sequence alignments.
For example:
FastTree protein_alignment.fasta > protein_tree.nwk
FastTree supports several amino-acid substitution models, including JTT, WAG, and LG.
For example, a WAG-based analysis can be requested with:
FastTree -wag protein_alignment.fasta > protein_tree.nwk
An LG-based analysis can be run with:
FastTree -lg protein_alignment.fasta > protein_tree.nwk
The appropriate model depends on the biological dataset and analytical objective.
Understanding the Output
FastTree produces a phylogenetic tree in Newick format.
A simplified Newick tree might look like:
((Sequence_A,Sequence_B),(Sequence_C,(Sequence_D,Sequence_E)));
The nested parentheses describe the branching structure of the tree.
You don't normally need to read Newick notation manually. Instead, you can load the file into a phylogenetic tree viewer.
Popular visualization options include tools such as iTOL and other Newick-compatible tree viewers.
For example:
tree.nwk
β
Tree viewer
β
Visual phylogenetic tree
Reading a Phylogenetic Tree
A tree contains several types of information.
Leaves
The tips or leaves of the tree represent your sequences or organisms.
Branches
Branches describe relationships inferred by the phylogenetic analysis.
Internal Nodes
Internal nodes represent inferred branching points connecting groups of sequences.
Branch Lengths
Depending on the analysis and visualization, branch lengths can provide information about the amount of evolutionary change represented by a branch.
It is important not to interpret every visual feature of a tree as a direct measurement of biological time. Tree topology, branch length, and rooting answer different questions.
What Are Support Values?
A phylogenetic tree can contain support values indicating how strongly particular splits are supported by the underlying data and analytical procedure.
FastTree computes local support values using an SH-like local support procedure.
These values help researchers distinguish between strongly supported and weakly supported branches.
For example, a tree might visually contain:
βββ Sequence_A
0.98β
βββ Sequence_B
The value 0.98 represents strong support for that particular split under the support calculation used by FastTree.
FastTree reports these local support values between 0 and 1 rather than 0 and 100.
However, support values should not be interpreted as a simple probability that the entire branch or evolutionary hypothesis is "true." They are statistics associated with the particular method and data.
FastTree and Large Datasets
One of FastTree's most important features is its ability to work with very large sequence alignments.
The developers report examples involving tens of thousands and even hundreds of thousands of sequences. FastTree uses heuristic strategies to reduce the amount of computation required during tree construction while still performing likelihood-based optimization.
For very large datasets, FastTree also provides options such as -fastest and a multi-threaded version based on OpenMP.
For example:
FastTree -nt -fastest sequences.fasta > tree.nwk
The -fastest option increases the aggressiveness of the heuristics used during the neighbor-joining phase.
The official documentation recommends considering -fastest for extremely large alignments, particularly when working with more than approximately 50,000 sequences.
For routine analyses, however, it is generally better to understand the default workflow before optimizing for speed.
Common Problems
My sequences are not aligned
This is the most important issue to recognize.
FastTree expects aligned sequences. If your sequences are raw, unaligned FASTA records, you should first perform an appropriate multiple sequence alignment.
A common workflow is:
Raw FASTA β Multiple sequence alignment β Alignment quality control β FastTree β Phylogenetic tree
My sequence names cause errors
FastTree requires unique sequence names and has restrictions on certain characters in names. The official documentation specifically warns about characters such as :, ,, and ( or ) because these characters have meaning in Newick trees.
Using simple identifiers such as:
>Sample_001 >Sample_002 >Sample_003
can help avoid unnecessary parsing problems.
FastTree reports unusual characters
FastTree recognizes the standard nucleotide alphabet and amino-acid alphabet, along with gaps and missing data. Ambiguous characters may produce warnings and can be treated as missing data.
For this reason, it is important to inspect your alignment before analysis rather than treating warnings as harmless by default.
The tree looks strange
A strange-looking tree does not necessarily mean that FastTree failed.
Unexpected topology can result from:
- Poor sequence alignment.
- Incorrect sequence homology assumptions.
- Highly divergent sequences.
- Long-branch attraction.
- Insufficient phylogenetic signal.
- Contaminated or incorrectly labeled sequences.
- Inappropriate model selection.
- Biological processes that violate assumptions of the analysis.
Phylogenetic inference is a complete analytical workflow, not simply a command that produces a tree.
FastTree Is Not the Same as "Fast Phylogenetics"
It is tempting to think of FastTree as simply a faster version of every other phylogenetic method.
That is not quite accurate.
FastTree uses its own combination of heuristics, evolutionary models, tree rearrangements, and likelihood approximations. Its goal is to make high-quality phylogenetic inference practical for large datasets.
This distinction matters because two phylogenetic programs can receive the same alignment and produce slightly different trees.
When comparing methods, researchers should therefore consider:
- The evolutionary model.
- The tree-search strategy.
- Support calculation.
- Alignment quality.
- Dataset size.
- Computational resources.
- The biological question.
FastTree vs. Alignment-Free Approaches
FastTree is particularly useful for researchers working with aligned sequences. But what happens when you have thousands or millions of sequences and want to avoid performing a traditional multiple sequence alignment in the first place?
This is where alignment-free approaches become interesting.
Instead of:
Sequences β Alignment β Phylogenetic inference
an alignment-free workflow may look more like:
Sequences β Sequence representation β Distance / embedding space β Clustering or phylogenomic analysis
Neither approach is universally better. They answer related questions using fundamentally different representations of biological information.
Alignment-based methods such as FastTree explicitly use positional correspondence between aligned sequences. Alignment-free approaches instead attempt to characterize sequence relationships without requiring that positional correspondence to be established first.
Where Covary Fits In
ChordexBio's Covary project explores the alignment-free side of this problem.
Rather than requiring users to first construct a multiple sequence alignment, Covary uses translation-aware sequence representations to compare biological sequences computationally.
This makes the two approaches conceptually useful to compare:
| Alignment-Based Workflow | Alignment-Free Workflow |
|---|---|
| Requires sequence alignment | Does not require traditional multiple sequence alignment |
| Uses positional correspondence | Uses sequence representations |
| Phylogenetic models operate on aligned sites | Relationships are analyzed in representation space |
| FastTree is an example | Covary is an example |
| Well-established phylogenetic framework | Alternative framework for scalable sequence analysis |
This distinction is particularly useful when designing large-scale genomic studies. A researcher may use alignment-based tools for detailed evolutionary analysis while using alignment-free methods for rapid exploration of very large sequence collections.
A Practical FastTree Workflow
For a typical research project, the workflow might look like this:
1. Collect sequences
β
2. Quality control
β
3. Confirm sequence homology
β
4. Generate multiple sequence alignment
β
5. Inspect and clean the alignment
β
6. Select an appropriate evolutionary model
β
7. Run FastTree
β
8. Inspect support values
β
9. Visualize the Newick tree
β
10. Interpret alongside biological metadata
This workflow emphasizes an important principle in computational biology: the quality of the input and the assumptions behind the analysis matter as much as the software itself.
Example: Building a Small DNA Phylogeny
Suppose you have an alignment called:
viral_sequences.fasta
You can perform a basic nucleotide analysis with:
FastTree -nt viral_sequences.fasta > viral_tree.nwk
If you want to use the GTR model:
FastTree -nt -gtr viral_sequences.fasta > viral_tree_gtr.nwk
You can then open the resulting Newick file in a compatible phylogenetic tree viewer.
The final interpretation should incorporate information such as sample origin, collection date, host, known taxonomy, and other relevant metadata.
Key Takeaways
- FastTree is an open-source tool for inferring phylogenetic trees from nucleotide or protein sequence alignments.
- It is designed to make large-scale phylogenetic inference substantially faster than many traditional approaches.
- FastTree requires an alignment as input.
- It can produce trees using nucleotide and amino-acid evolutionary models.
- The output is typically a Newick-format phylogenetic tree.
- Support values can help researchers evaluate the strength of inferred splits.
- Large datasets can benefit from FastTree's optimized heuristics and multi-threading options.
- Good phylogenetic analysis depends on sequence quality, alignment quality, model assumptions, and biological interpretation.
- FastTree represents an alignment-based approach, while ChordexBio's Covary explores alignment-free genomic analysis.
Continue Learning
If you're learning computational phylogenetics, a useful next step is to understand the difference between alignment-based and alignment-free sequence analysis.
The two approaches are not simply competing software packages. They represent different ways of turning biological sequences into information that computers can analyze.
For a deeper introduction to alignment-free analysis, explore:
What Are Alignment-Free Genomics and Why Is It Transforming Genome Analysis?
You can also explore k-mer representations as one of the foundational ideas behind many alignment-free computational approaches:
Understanding k-mers: The Foundation of Modern Genome Analysis
Hi, Iβm Dexter π I handle resource management at ChordexBioβbuilding tutorials, guides, and technical content that actually make sense. I like breaking down complex ideas into clear, usable write-ups, whether itβs for onboarding, research workflows, or product documentation.