Main Tools
🧬 DNA & RNA Tools 15 tools 🌡️ PCR Tools 14 tools ⚗️ Lab Calculators 14 tools
More Tools
🔬 Protein Tools 13 tools 🦠 Microbiology Tools 13 tools 🧫 Cell Biology Tools 11 tools 📚 Reference Tools 9 tools
ℹ️ About Us Contact Us
🧹 DNA & RNA Tool

Sequence Cleaner

Remove invalid characters from DNA or RNA sequences. Handles FASTA headers, ambiguous IUPAC bases, whitespace, and case conversion in one step.

The Sequence Cleaner prepares raw DNA or RNA sequences for downstream analysis by stripping invalid characters, handling IUPAC ambiguous bases, and standardising output format. It is used by molecular biologists, bioinformaticians, and students who need clean, tool-ready sequences from database exports, sequencing reports, or published papers.

🧹 Sequence Cleaner FREE TOOL
🧪 Messy DNA Example 📄 Multi-FASTA Example 🔤 Ambiguous Bases Example
IUPAC Ambiguous Base Quick Reference
CodeMeaningBases
NAny baseA/T/G/C
RPurineA/G
YPyrimidineC/T
SStrongG/C
WWeakA/T
KKetoG/T
MAminoA/C
BNot AC/G/T
DNot CA/G/T
HNot GA/C/T
VNot TA/C/G
📋 See a Worked Example ▾
Scenario: You exported a gene sequence from a genome browser and it contains lowercase soft-masked regions, digit-based position numbers, and an "N" gap character you want removed before ordering a synthetic construct.

Input: ATGCG10NNNNatcgTAGCTA, Sequence Type: DNA, Ambiguous Bases: Remove.

Result: Digits and the ambiguous "N" gap are stripped, lowercase bases are uppercased, and the stats bar reports how many bases were removed.

Why it matters: Synthesis vendors typically require a strictly unambiguous A/T/G/C sequence, so removing gap and ambiguity codes before submitting the order avoids a rejected quote or a manually edited sequence.

How to Use the Sequence Cleaner

The Sequence Cleaner is designed to accept raw, unformatted nucleotide data and return a clean sequence that is immediately compatible with downstream bioinformatics tools. The workflow takes only seconds and requires no installation or registration.

Step-by-Step Instructions

Step 1 — Paste your sequence: Copy your DNA or RNA sequence from any source — a GenBank record, a sequencing report, a published paper, or your own lab notebook — and paste it directly into the input box. The tool accepts both plain sequences and multi-FASTA formatted blocks containing multiple sequences separated by header lines.

Step 2 — Select the sequence type: Choose DNA if your sequence contains thymine (T) as the fourth base, or RNA if it contains uracil (U). This selection determines the valid character set. In DNA mode, any U residues will be treated as invalid; in RNA mode, any T residues will be removed. Making the wrong choice here is the most common cause of unexpectedly large removal counts.

Step 3 — Set ambiguous base handling: IUPAC nomenclature defines codes for positions that could be one of several bases — N for any base, R for purine (A or G), Y for pyrimidine (C or T), and so on. Choose Keep ambiguous bases if your downstream tool supports these codes, or Remove ambiguous bases if you need a strictly unambiguous A/T/G/C sequence.

Step 4 — Configure FASTA header and case options: If your input is a FASTA file, choose whether to preserve the header lines (lines beginning with >) or strip them from the output. The case option lets you output the sequence in uppercase (the standard for most databases and submissions) or lowercase (used for soft-masked regions in genome assemblies).

Step 5 — Click Clean Sequence: The cleaned output appears in the result box along with a summary showing the total input bases, the number kept, and the number removed. Use this stats line to verify the cleaning was applied as expected.

Step 6 — Copy and use: Click Copy Result to copy the cleaned sequence to your clipboard. It is now ready to paste into BLAST, ClustalW, Primer3, SnapGene, or any other tool that requires clean input.

What Gets Removed

The cleaner strips all characters that are not valid nucleotides for the selected mode. This includes whitespace (spaces, tabs, line breaks within sequence lines), digits (sequence position numbers added by some viewers), punctuation, and any letter not in the allowed set. Ambiguous IUPAC bases — R, Y, K, M, S, W, B, D, H, V, and N — are removed or kept based on your ambiguous base setting.

IUPAC Ambiguous Base Reference

The full set of IUPAC ambiguity codes used by this tool is: N = any base (A/T/G/C), R = purine (A/G), Y = pyrimidine (C/T), S = strong (G/C), W = weak (A/T), K = keto (G/T), M = amino (A/C), B = not A (C/G/T), D = not C (A/G/T), H = not G (A/C/T), V = not T (A/C/G). These codes are defined by the International Union of Pure and Applied Chemistry and are recognised by most major bioinformatics platforms.

When to Use This Tool

Use the Sequence Cleaner whenever your sequence data comes from a source that may have introduced non-nucleotide characters. Common scenarios include: copying a GenBank flat file entry that includes line numbers and feature annotations; extracting sequence text from a PDF paper where the copy operation introduces spaces every ten bases; receiving raw Sanger sequencing output that includes quality score markers; or working with a multi-FASTA export from a genome browser that includes soft-masked lowercase and hard-masked N regions you want to handle consistently. It is also useful as a pre-processing step before GC content analysis, melting temperature calculation, or codon usage tabulation.

Common Mistakes to Avoid

Wrong sequence type: Pasting an mRNA sequence (with U) while the mode is set to DNA will remove every uracil, silently truncating your sequence. Always verify the sequence type before cleaning.

Discarding needed ambiguous bases: If you are cleaning a degenerate primer or a draft genome assembly, removing IUPAC codes may corrupt the biological meaning. Check whether your intended downstream application supports ambiguous bases before choosing the Remove option.

Losing FASTA headers in multi-sequence files: Selecting Remove headers on a multi-FASTA file will concatenate all sequences into one block with no identifiers, making it impossible to trace which output sequence corresponds to which input entry. Use Preserve headers unless you specifically need raw concatenated sequence.

Interpreting Your Results

The stats bar below the output shows four values: Input bases is the count of all non-whitespace characters in sequence lines (excluding FASTA headers); Kept is the count of valid nucleotides that passed into the output; Removed is the difference between input and kept; and Mode confirms which sequence type and case were applied. A removal count close to zero confirms the input was already clean. A high removal count warrants investigation — check the sequence type setting and whether ambiguous base removal was appropriate for your data.

Frequently Asked Questions

What characters does the Sequence Cleaner remove?

The tool removes any character that is not a valid nucleotide for the selected sequence type. In DNA mode, only A, T, G, and C are kept; in RNA mode, only A, U, G, and C are retained. This includes spaces, tabs, digits, punctuation, line numbers, and invalid letters commonly introduced when copying sequences from papers or databases. Ambiguous IUPAC base codes (R, Y, K, M, S, W, B, D, H, V, N) are optionally removed or kept depending on your setting. FASTA header lines beginning with '>' are handled separately through the FASTA mode option.

When should I keep versus remove IUPAC ambiguous bases?

Keep ambiguous bases when your downstream application supports the full IUPAC alphabet — for example, when passing sequences to alignment tools, primer design software, or BLAST searches that recognise degenerate bases. Remove them when you need a strictly unambiguous sequence, such as for synthesis orders, restriction enzyme analysis, or tools that only accept standard A/T/G/C input. Ambiguous codes represent positions where sequencing was uncertain or where a degenerate primer is intentionally designed to match multiple variants, so their biological meaning should not be discarded without consideration.

Does the tool support multi-sequence FASTA files?

Yes. The Sequence Cleaner fully supports multi-FASTA input containing any number of sequences separated by header lines beginning with '>'. When FASTA header preservation is enabled, each header line is passed through unchanged and the following sequence lines are cleaned according to your settings. When header removal is selected, only the cleaned nucleotide sequences are output with all header lines discarded. This makes it easy to batch-clean entire alignment files or genome annotation exports before further processing.

Why does my cleaned sequence have fewer bases than expected?

If significantly more bases were removed than anticipated, the most common cause is a sequence type mismatch. For example, pasting an RNA sequence (containing U) while the tool is set to DNA mode will remove all uracil residues because U is not a valid DNA base. Similarly, choosing Remove ambiguous bases will eliminate IUPAC codes such as N, R, and Y that may constitute a large fraction of a draft assembly or degenerate primer sequence. Check the stats bar below the output for the exact count of kept versus removed characters to diagnose the discrepancy.

What is the difference between uppercase and lowercase output?

The output case option controls whether the cleaned sequence is returned in uppercase (ATGC) or lowercase (atgc) letters. Both formats are biologically equivalent and represent the same nucleotide sequence. Uppercase is the convention for most published sequences, GenBank submissions, and software inputs. Lowercase notation is sometimes used in genome annotation to indicate repeat-masked or soft-masked regions. Choose the case that matches the requirement of your downstream analysis tool or submission pipeline.