Why Run BLAST Locally?
NCBI BLAST (blast.ncbi.nlm.nih.gov) is the most widely used sequence search tool, but it has limitations. Server queues during peak hours can add 15-60 seconds of wait time per search. You cannot upload custom databases. You cannot run thousands of queries in batch without writing a script. And you are limited to NCBI's database collection.
Local BLAST solves all of these problems. The NCBI BLAST+ package is free, open-source, and runs entirely on your computer. You can:
- Search any database — download NCBI databases or create your own from FASTA files
- Run thousands of queries — batch processing without server limits
- Control all parameters — adjust word size, gap penalties, scoring matrices, and e-value thresholds
- Get results faster — no network latency, no server queues
- Work offline — no internet connection required after database download
Installation Steps
Linux (Ubuntu/Debian)
# Download BLAST+ (check ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ for current version)
cd /opt
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-linux.tar.gz
tar -xzf ncbi-blast-2.16.0+-x64-linux.tar.gz
# Add to PATH (add to ~/.bashrc for permanent)
export PATH=$PATH:/opt/ncbi-blast-2.16.0+/bin
# Verify installation
blastn -version
Mac (macOS)
# Option 1: Homebrew (recommended)
brew install blast
# Option 2: Manual download
# Download from ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/
# Extract and add bin/ to PATH
export PATH=$PATH:/path/to/ncbi-blast-2.16.0+/bin
# Verify
blastn -version
Windows
Database Setup
BLAST requires formatted databases. You can download pre-built NCBI databases or create custom ones from your own sequences.
Downloading NCBI Databases
# Download the nt database (nucleotide, ~100 GB)
update_blastdb.pl --decompress nt
# Download the nr database (protein, ~150 GB)
update_blastdb.pl --decompress nr
# Download a smaller database (refseq_rna, ~15 GB)
update_blastdb.pl --decompress refseq_rna
Creating a Custom Database
Custom Database Example
Suppose you have 500 human gene sequences in a file called human_genes.fasta. Running makeblastdb -in human_genes.fasta -dbtype nucl -out human_genes_db creates index files (human_genes_db.nsq, .nin, .nhr) that BLAST can search. This is useful for searching your own sequencing data against a known set of genes.
Running Queries
Basic Searches
# Limit results to top 10 hits
blastn -query seq.fasta -db nt -max_target_seqs 10 -out results.txt
# Adjust E-value threshold
blastn -query seq.fasta -db nt -evalue 1e-50 -out results.txt
# Use a specific scoring matrix
blastp -query prot.fasta -db nr -matrix BLOSUM45 -out results.txt
Batch Processing
Output Formatting
The -outfmt option controls BLAST output format. This is one of the most powerful features of local BLAST — you can customise the output to include exactly the fields you need for downstream analysis.
Format
Description
Use Case
-outfmt 0
Pairwise alignment (default)
Manual inspection, publication figures
-outfmt 6
Tabular (no headers)
Pipeline analysis, filtering, sorting
-outfmt 7
Tabular with comment headers
Readable tabular output
-outfmt '6 qseqid sseqid pident...'
Custom tabular columns
Specific fields for your analysis
Need BLAST Without Installation?
Run BLAST free online with instant results. Supports blastn, blastp, blastx, tblastn, and tblastx. No NCBI account required. No server queue.
Try Online BLAST →