Biology

How to Convert SRA to FASTQ 2026: Complete Guide

If you work in bioinformatics, you often come across data from NCBI’s Sequence Read Archive (SRA). This massive database stores raw sequencing data from thousands of studies. However, the data is stored in the SRA format, and to do almost anything useful with it—like alignment, quality control, or assembly—you first need to convert it to the universal FASTQ format. In this guide, we’ll cover the most reliable methods to convert your SRA data into the analysis-ready FASTQ format.

What Are SRA and FASTQ Files?

SRA (Sequence Read Archive) is a proprietary format used by the NCBI to archive raw sequencing data from Next-Generation Sequencing (NGS) platforms. It is highly compressed and complex, designed for long-term storage and space efficiency, not for direct analysis. In contrast, FASTQ is the universal, text-based standard format for storing biological sequences (like DNA/RNA) along with their corresponding quality scores. Nearly all bioinformatics analysis tools accept FASTQ as the standard input format.

ncbi-sra

Why Convert SRA to FASTQ?

The primary reason to convert SRA to FASTQ is usability. Standard and critical bioinformatics tools, such as quality control applications (e.g., FastQC) and alignment software (e.g., BWA, Bowtie2, and STAR), cannot read the SRA archive format directly. These tools are built to parse the four-line FASTQ format to read sequences and their quality scores. Therefore, converting SRA to FASTQ is the essential first step in any sequencing data analysis pipeline; it turns the data from an “archival” state into an “operational” and analyzable state.

How to Convert SRA to FASTQ

There are two primary ways to convert SRA data: using the command-line toolkit (the most common and powerful method) or using a simple online tool.

Method 1: Using the SRA Toolkit (Recommended)

The primary tool for this job is the SRA Toolkit, provided by NCBI. It includes powerful utilities like fasterq-dump and prefetch to handle the conversion from the command line. If you haven’t installed it yet, follow our complete guide to installing the SRA Toolkit on Windows, Linux, and macOS. Once installed, you can test it by typing fasterq-dump –version in your terminal.

fasterq-dump --version

Here are the recommended workflows:

1.1. Using fasterq-dump directly

The SRA Toolkit provides two utilities: the older fastq-dump and the modern, much faster fasterq-dump. We strongly recommend using fasterq-dump as it is multi-threaded and significantly more efficient.

Key Difference: The main difference is performance. fasterq-dump is designed for high-speed, parallel conversion, while fastq-dump is single-threaded and much slower. For any large dataset, fasterq-dump is the correct choice.

Basic Command (Single-End): This command downloads and converts the data in a single step.

# This will download and convert, creating SRR123456.fastq
fasterq-dump SRR123456

Paired-End Data: Use the --split-files flag to get two separate files (Read 1 and Read 2).

# This creates SRR123456_1.fastq and SRR123456_2.fastq
fasterq-dump --split-files SRR123456

Notes on Speed, Memory, and Temp Files: You can control the conversion with several useful flags. To speed up the process, use the -e <threads> flag to specify the number of processor threads (e.g., -e 8). Add -p to show a progress bar. You can set a specific output folder with -O <dir> (or --outdir <dir>). Finally, since fasterq-dump can use a lot of temporary disk space, you should specify a different location using --temp /path/to/large/storage if your default /tmp directory is small.

All-in-One Recommended Command:

# Run the conversion with 8 threads, progress bar,
# and specify an output directory "my_fastq_files"
fasterq-dump \
  -e 8 \             # Use 8 threads
  -p \               # Show progress
  --split-files \    # Split into R1 and R2
  --outdir "my_fastq_files" \  # Set output directory
  SRR123456

1.2. Using prefetch + fasterq-dump

For very large files or unstable connections, it’s safer to download the data first using prefetch and then convert the local file. This two-step process is more reliable.

Step 1: Download the SRA file

prefetch SRR123456

This downloads the SRA data. By default, it’s stored in ~/ncbi/public/sra/ (e.g., ~/ncbi/public/sra/SRR123456.sra).

Step 2: Convert the local SRA file

Now, you run fasterq-dump on the file path instead of the accession number. This avoids any network issues during the conversion step.

# Convert the *local* .sra file, outputting to "my_fastq_files"
fasterq-dump \
  -e 8 -p --split-files \
  --outdir "my_fastq_files" \  # Set output directory
  ~/ncbi/public/sra/SRR123456.sra

Method 2: Using an Online SRA to FASTQ Converter

For users who are not comfortable with the command line, an online tool can be a simple alternative. We provide our own easy-to-use converter: SRA to FASTQ Converter

SRA to FASTQ Converter

This tool allows you to upload your .sra file directly. It will then process the conversion and provide the resulting FASTQ files for download. Be aware of the limitations common to most online tools: most free platforms have limits on the maximum data size you can upload, conversions may be slow or queued (especially for large files), and you are processing your data on a third-party server, which has security and privacy implications.

Interactive Command Builder

Use this tool to build the perfect `fasterq-dump` command for your needs.

e.g., `SRR123456` or `~/ncbi/public/sra/SRR123456.sra`

2. Data Type

Your Generated Command:

A Note on Converting to FASTA

It’s technically possible to convert directly to FASTA, but this is strongly discouraged for raw sequencing data. The FASTA format only stores the nucleotide sequence (the As, Ts, Cs, and Gs) and completely discards all the associated quality scores. These quality scores are essential for nearly all downstream analyses, such as read alignment and variant calling, as they tell your tools how confident the base-caller was for each nucleotide. If you have a specific reason and are absolutely certain you do not need quality scores, you can force the conversion using the --fasta flag:

fasterq-dump --fasta -O . SRR123456

Common Issues and How to Fix Them

Although the process is straightforward, you may encounter a few common issues.

1. Error: command not found: fasterq-dump

  • Problem: The terminal doesn’t recognize the fasterq-dump command.
  • Solution: This means the SRA Toolkit is either not installed or, more likely, not in your system’s PATH. Your PATH tells the terminal where to find executable programs. Revisit our installation guide to ensure you’ve added the toolkit’s bin directory to your PATH environment variable (e.g., in your .bashrc or .zshrc file).

2. Error: Network Connection Fails or Timeout

  • Problem: fasterq-dump or prefetch fails with an error like “connection timed out” or “name resolution failed.”
  • Solution: This is a network issue. First, check your internet connection. Firewalls (especially in academic or corporate settings) can also block the ports NCBI uses. The most reliable solution is to use the prefetch + fasterq-dump method (Method 1.2). prefetch is more robust for downloading and can be re-run if it fails.

3. Error: “No space left on device” or “/tmp is full”

  • Problem: fasterq-dump needs a lot of temporary disk space during conversion. If your default /tmp directory is on a small partition (common on servers), it will fill up and crash.
  • Solution: As mentioned in Method 1.1, use the --temp flag to specify a directory with more space.
    fasterq-dump --temp /path/to/large/storage --split-files SRR123456
    

4. Error: Corrupted Download or “Bad SRA File”

  • Problem: fasterq-dump fails when run on a local .sra file that you downloaded with prefetch. The file may have been corrupted during the download.
  • Solution: Delete the bad file and download it again.
    # Find and delete the local file
    rm ~/ncbi/public/sra/SRR123456.sra
    
    # Re-run prefetch
    prefetch SRR123456
    
    # Try the conversion again
    fasterq-dump --split-files ~/ncbi/public/sra/SRR123456.sra
    

5. Error: Tool Asks for Configuration (vdb-config -i)

  • Problem: The first time you run any SRA Toolkit command, it might stop and ask you to run vdb-config -i to set up caching.
  • Solution: Just do what it says! Run vdb-config -i in your terminal. An interactive menu will appear. The most important setting is to “Enable Local File Caching.” You can accept the default location (~/ncbi/public) and default cache size. This only needs to be done once.

FAQ

1. What’s the difference between SRR, SRP, and SRX numbers?

This is a common point of confusion. The SRP (Study) number (e.g., SRP123456) refers to the entire project, which contains one or more experiments. The SRX (Experiment) number (e.g., SRX123456) refers to a specific experiment within that study. Finally, the SRR (Run) number (e.g., SRR123456) is the actual sequencing run data file that contains the raw reads. You must use the SRR accession number (e.g., SRR123456) with fasterq-dump and prefetch. If you only have an SRP or SRX, you will need to go to the SRA database to find the list of SRR files associated with it.

2. Why are my FASTQ files so much larger than the SRA file?

This is completely normal. The .sra format uses highly advanced compression to archive data efficiently. FASTQ, on the other hand, is a simple, uncompressed text format. It’s common for the resulting FASTQ files to be 5, 10, or even 20 times larger than the original .sra file.

This article was reviewed for accuracy by Dr. Mosayeb Rostamian. The content is based on current scientific evidence and is intended for educational purposes only.

Reference

  1. Rasko Leinonen, Hideaki Sugawara, Martin Shumway, on behalf of the International Nucleotide Sequence Database Collaboration, The Sequence Read Archive, Nucleic Acids Research, Volume 39, Issue suppl_1, 1 January 2011, Pages D19–D21, https://doi.org/10.1093/nar/gkq1019
  2. Peter J. A. Cock, Christopher J. Fields, Naohisa Goto, Michael L. Heuer, Peter M. Rice, The Sanger FASTQ file format for sequences with quality scores, and the Solexa/Illumina FASTQ variants, Nucleic Acids Research, Volume 38, Issue 6, 1 April 2010, Pages 1767–1771, https://doi.org/10.1093/nar/gkp1137
  3. https://github.com/ncbi/sra-tools

Mahdi Morshedi Yekta

I have a bachelor’s degree (B.Sc.) in Medical Laboratory science and now I am Master student in Medical Biotechnology science. Nothing fascinates me more than medical science, as it constantly challenges me to learn new things and improve my skills.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *