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.

🧹 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

Introduction

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.

About the Tool

Sequence Cleaner is a browser-based nucleotide cleanup utility for anyone working with real-world sequence data. Sequences copied from GenBank records, sequencing reports, PDF papers, or lab notebooks rarely arrive in a directly usable format — they often carry stray whitespace, position numbers, formatting artifacts, and mixed-case letters. The tool applies a consistent, rule-based filter to every character in the input, keeping only valid bases for the selected sequence type while giving you control over ambiguous IUPAC codes, FASTA headers, and output case. The workflow takes only seconds, requires no installation or registration, and everything runs locally in your browser.

Input Explanation

Input Sequence: Paste your DNA or RNA sequence from any source — a GenBank record, a sequencing report, a published paper, or your own lab notebook. The tool accepts both plain sequences and multi-FASTA formatted blocks containing multiple sequences separated by header lines.

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 are treated as invalid, and in RNA mode any T residues are removed.

Ambiguous Bases (IUPAC): 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 if your downstream tool supports these codes, or Remove if you need a strictly unambiguous A/T/G/C sequence.

FASTA Headers: If your input is a FASTA file, choose whether to preserve the header lines (lines beginning with >) or strip them from the output.

Output Case: Choose uppercase (the standard for most databases and submissions) or lowercase (used for soft-masked regions in genome assemblies).

Formula Explanation

Sequence Cleaner works by testing every character in the input against an allowed-character set built from your settings, rather than applying a numeric formula. The base allowed set is A/T/G/C for DNA or A/U/G/C for RNA. If ambiguous bases are kept, the eleven IUPAC codes (R, Y, K, M, S, W, B, D, H, V, N) are added to that set. The tool then reads the input line by line: lines beginning with '>' are treated as FASTA headers and passed through or discarded based on your header setting, while every other line has whitespace, digits, punctuation, and any character outside the allowed set removed, with the remaining bases converted to your chosen output case. This character-by-character filtering is what the stats bar's input, kept, and removed counts describe.

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.

Result Interpretation

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. When the removal rate is unusually high, the advisory box above the result will flag the likely cause automatically.

Practical Applications

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.

Scientific Notes & Limitations

Sequence Cleaner performs character-level filtering only — it does not perform biological validation, alignment, or error correction. It cannot detect frameshifts, verify open reading frames, or confirm that a cleaned sequence still represents the intended construct; checks like those require dedicated tools such as ORF finders or alignment software. IUPAC ambiguity codes are treated as informational content, not resolved to a single base — removing them discards information rather than "correcting" it, so the choice to keep or remove them should be made deliberately for your specific use case rather than left on the default setting.

Practical Tips

Run a cleaned sequence through the GC Content Calculator or Nucleotide Counter afterward to sanity-check that the base composition looks as expected. If you're preparing sequences for gene synthesis, keep ambiguous-base removal on, since most vendors only accept standard A/T/G/C input. When cleaning multiple sequences from a genome browser export, preserve FASTA headers so you can trace each cleaned sequence back to its source entry. If the advisory box warns of an unexpectedly high removal rate, check the sequence type setting first — a DNA/RNA mismatch is the most common cause.

Common Mistakes

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.

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.