TXT to FASTA converter
Paste or upload DNA, RNA, or protein text and download FASTA. Sequence names, wrapped lines, and tables are detected automatically, and nothing leaves your browser.
To convert a TXT file to FASTA, give every sequence a header line that starts with > followed by its name, put the sequence on the lines below, and save the file as plain text with a .fasta extension. You can do it online with this converter, by hand in a text editor, or with an awk one-liner on the command line.
The converter finds sequence names, joins wrapped lines, strips copied numbering and spacing, and writes one FASTA record per sequence. It runs in your browser, and no account is needed.
.txt, Word (.docx), or PDF file..txt file in Notepad, TextEdit, or any plain text editor.> and a short name, such as >primer_F. Leave no space after the >..fasta or .fa extension. In Notepad, set Save as type to All files so the name doesn't become sequences.fasta.txt; in TextEdit, choose Format, then Make Plain Text first.primer_F ATGGATTTATCTGCTCTTCG
primer_R CTAAGATTTTCTGCATAGCA>primer_F
ATGGATTTATCTGCTCTTCG
>primer_R
CTAAGATTTTCTGCATAGCARenaming sequences.txt to sequences.fasta without adding the > lines does not make a FASTA file. Most programs reject it, because the header line is what marks where each record starts.
When each line holds a name and a sequence separated by a space or tab, as in the input above, this awk command writes the same FASTA output:
awk '{ printf ">%s\n%s\n", $1, $2 }' sequences.txt > sequences.fastaFor a file with one unnamed sequence per line, number the records instead. Two lines of sequence become >seq_1 and >seq_2:
awk '{ printf ">seq_%d\n%s\n", NR, $0 }' sequences.txt > sequences.fastaBoth commands assume one complete sequence per line. They don't join wrapped sequences, strip position numbers, or keep a name that contains spaces, and a file saved on Windows needs its carriage returns removed first with tr -d '\r' < sequences.txt > clean.txt. Text copied from a database or a paper usually breaks at least one of these assumptions, which is where the converter above is faster.
A name line above a sequence becomes the FASTA header, and a sequence wrapped over several lines stays one record:
Human insulin
MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKT
RREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN>Human_insulin
MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPL
ALEGSLQKRGIVEQCCTSICSLYQLENYCNSeveral named sequences become a multi-FASTA file. Blank lines between them are optional:
GFP
MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTT
mCherry
MVSKGEEDNMAIIKEFMRFKVHMEGSVNGHEFEIEGEGEGRPYEGTQTAKL>GFP
MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTT
>mCherry
MVSKGEEDNMAIIKEFMRFKVHMEGSVNGHEFEIEGEGEGRPYEGTQTAKLText copied from GenBank, UniProt, or a paper keeps its position numbers and 10-residue blocks. Those are removed and the lines are joined:
BRCA1 fragment
1 atggatttat ctgctcttcg cgttgaagaa gtacaaaatg tcattaatgc
51 tatgcagaaa atcttagagt>BRCA1 fragment
ATGGATTTATCTGCTCTTCGCGTTGAAGAAGTACAAAATGTCATTAATGCTATGCAGAAAATCTTAGAGTA line with one sequence and no name, such as a list of primers or peptides, becomes one record per line (>seq_1, >seq_2, and so on). Spreadsheet columns work too. Headers such as name and sequence identify the columns, even when a name or note could also be read as amino acid letters. Extra columns and the header row are skipped:
name sequence notes
primer_F ATGGATTTATCTGCTCTTCG forward
primer_R CTAAGATTTTCTGCATAGCA reverse>primer_F
ATGGATTTATCTGCTCTTCG
>primer_R
CTAAGATTTTCTGCATAGCAPlain text has no fixed layout, so each line is sorted into sequence, name, or text to skip before any FASTA is written.
Human insulin, BRCA1 fragment, seq1:, or Gene: INS names the sequence below it. An identifier followed by a description, such as NM_007294.4 Homo sapiens BRCA1, keeps both in the header. A short all-caps line like GFP counts as a name only when a much longer sequence follows it, and the result tells you when that happened.seq1: ATGC..., seq1 ATGC..., 1. ATGC..., and two-column name,sequence rows keep the name out of the sequence.> always start a new record and keep their header text. An introduction line or a ; comment before the first header is skipped.Prose that isn't sequence, such as Here are my sequences:, is skipped and listed in the result. If the layout is ambiguous, Multi-sequences overrides the automatic choice.
| Input | Description |
|---|---|
Input | Pasted text or one uploaded file with DNA, RNA, or protein sequences. Text, FASTA, CSV, TSV, GenBank, EMBL, FASTQ, alignment, and structure files are read as text; .docx and .pdf files are converted to text first. Up to 10 million characters and 10 MB per file. |
Empty files show an error and leave the upload control available. Choose a file containing sequence data to continue without reloading.
The basic settings cover most inputs. Change Multi-sequences only when the automatic reading of your text is wrong.
| Setting | Description |
|---|---|
Multi-sequences | How sequences are separated. Auto-detect sequences (default) uses the rules above. Split on empty lines treats each block between blank lines as one sequence, with an optional name on its first line. Join all lines into one sequence converts the whole input as one record. Custom separator splits on the text you enter. Lines starting with > start a new record in every mode. |
Custom separator | Text that separates sequences when Custom separator is selected. Default: ---. The escapes \t, \n, and \r stand for tab and line breaks. An empty separator is rejected. |
Sequence type | Auto-detect (default), DNA, RNA, Nucleotide (DNA or RNA), or Protein. A specific type removes letters outside that alphabet, and Validation reports them. A sequence with U under DNA, or T under RNA, is skipped with an explanation instead of being altered. |
Sequence names | Input (default) keeps FASTA headers, name lines, table IDs, and file accessions; unnamed sequences become seq_1, seq_2, and so on. Numbered replaces every name. |
Name prefix | Shown for Numbered names. Text before the number, such as fp for fp_1. Default: seq. Spaces and punctuation are cleaned so the prefix can't break a header. |
Line wrapping | Sequence characters per output line: 80 (default), 60, None for a single line, or Custom. |
Custom line length | Shown for custom wrapping. 0 turns wrapping off; a negative or non-numeric value uses 80. Default: 80. |
The advanced settings control cleanup and validation.
| Setting | Description |
|---|---|
Case format | Upper (default), Lower, or Original, which keeps soft-masked lowercase regions. |
Character cleanup | Turns the four removal switches below on or off together. Default: on. |
Remove spaces and tabs | Removes spaces and tabs inside sequences, such as the gaps between 10-residue blocks. Default: on. |
Remove numbers | Removes digits such as residue positions. Default: on. |
Remove punctuation | Removes punctuation, including * and - unless the preserve switches keep them. Default: on. |
Preserve alignment gaps | Keeps - and . so aligned sequences stay aligned. Default: off. |
Preserve stop codons | Keeps a terminal * stop marker. Internal * characters still fail validation. Default: off. |
Remove invalid characters | Removes symbols that are not sequence letters, and letters outside the chosen Sequence type. Characters kept by the switches above are reported by validation instead. Default: on. |
Validation | Lenient (default) removes invalid characters and says what changed. Strict skips any sequence that would need spaces, numbers, punctuation, or letters removed. Off skips the alphabet check. |
Keep descriptions | Shown for Numbered names. Keeps the original name and description after the new name, for example >fp_1 GFP. Default: off. |
The result opens on the FASTA preview, with a one-line summary above it such as 2 sequences · 101 residues · Protein. When the input came from a recognized format, the summary also says so (read as GenBank).
Changes that could matter show as notices above the preview: removed stop codons or gap characters, letters outside the chosen sequence type, skipped text lines, skipped sequences with the reason, and short lines that were used as names. Removing spaces, numbers, and line breaks is expected and does not raise a notice.
If no sequence passes validation, the result shows the reason and keeps a downloadable run.log in Logs and Files. Correct the input or change the relevant setting to regenerate the preview. A rejected conversion produces no FASTA file.
| Output | Description |
|---|---|
| FASTA file | One record per sequence, a > header followed by wrapped sequence lines. Uploaded files keep their name (sequences.txt becomes sequences.fasta). |
run.log | Settings, detected input format, sequence statistics, per-category cleanup counts, and every notice. Shown in Logs and downloadable from Files. |
Upload the .docx file directly, or copy the text out of Word and paste it. The document text is extracted in your browser, then read with the same rules as pasted text, so a gene name paragraph above a sequence paragraph becomes one named FASTA record. Formatting such as bold, colors, and tables is ignored; the characters Word inserts invisibly (non-breaking spaces, soft hyphens, curly quotes) are removed. PDF files work the same way when they contain selectable text, not scanned images.
FASTA is simple, but a few rules decide whether downstream tools accept a file.
>. The first word is the identifier and should be unique; anything after the first space is a free-text description.A, C, G, T, U, and IUPAC ambiguity codes such as N) or one-letter amino acid codes.- or .; turn on Preserve alignment gaps when converting an alignment.*; turn on Preserve stop codons to keep it. Tools that reject non-letters need it removed, and filtering protein sequences or filtering DNA sequences can clean an existing FASTA file.TXT to FASTA handles free text in any layout. A more specific converter fits when the input is a structured file or the output isn't FASTA.
| Your input | Converter | Why |
|---|---|---|
Pasted text, notes, .txt, Word, or PDF | TXT to FASTA | Finds names and sequences in free-form text. |
| A sequence file in another format | FASTA converter | Same engine, set up for GenBank, EMBL, FASTQ, and alignment files. |
| CSV with many columns | CSV to FASTA | Lets you pick the ID and sequence columns and prefixes. |
| GenBank CDS or protein translations | GenBank to FASTA | Extracts coding sequences and translations from the feature table. |
| Genes and other annotated features | GenBank Feature Extractor | Pulls any feature type with strand and joins handled. |
| FASTQ sequencing reads | FASTQ to FASTA | Drops quality lines, with quality filtering options. |
| PDB structure | PDB to FASTA | Reads chains from coordinates or SEQRES. |
| FASTA you want as a spreadsheet | FASTA to CSV | Writes CSV, TSV, or one sequence per line. |
The converted file is ready for sequence alignment, BLAST searches, and splitting into smaller FASTA files.
Upload the .txt file or paste its contents, and the converter writes one FASTA record per sequence with a header from the nearest name line. Download the .fasta file or copy the output. Without a converter, add a >name line above each sequence in a text editor and save the file with a .fasta extension.
Only if the file already has a > header line above every sequence. Renaming changes the extension, not the content, so a file of bare sequences stays unreadable to BLAST, aligners, and other FASTA tools.
For lines that hold a name and a sequence, run awk '{ printf ">%s\n%s\n", $1, $2 }' sequences.txt > sequences.fasta. For one unnamed sequence per line, awk '{ printf ">seq_%d\n%s\n", NR, $0 }' numbers the records. Neither joins wrapped lines or removes numbering.
Put a line that starts with > directly above the sequence. The first word after > is the identifier, for example >INS_human, and anything after the first space is a free-text description.
Yes. Upload the .docx file or paste its text. The text is extracted in the browser and names above sequences become FASTA headers.
Unnamed lines of different lengths are treated as a list of separate sequences. Add a name line above the sequence, or choose Join all lines into one sequence under Multi-sequences. The result shows a notice when equal-width lines were split.
Paste each sequence under its own name line, or use rows such as name,sequence. Each one becomes a separate record in a single multi-FASTA file.
DNA uses A, C, G, T, and ambiguity codes such as N, R, and Y. RNA uses U instead of T. Protein uses one-letter amino acid codes plus X, B, Z, J, O, and U.
Later duplicates get _2, _3, and so on appended to the identifier, before any description, so every identifier in the file is unique.
Choosing DNA for an RNA sequence skips it rather than deleting its U residues. Convert it with RNA to DNA, which replaces U with T.
Convert CSV or TSV sequence tables to FASTA with automatic delimiter detection and column mapping.
Paste or upload a sequence file in any common format and download FASTA. The format is detected automatically, and nothing leaves your browser.
Extract CDS, mRNA, gene, rRNA, and tRNA features from GenBank records into FASTA.
Paste or upload FASTA and download a CSV or TSV table for spreadsheets, or a plain text file with one sequence per line.
Convert FASTA sequences to FASTQ with configurable mock Phred quality scores.
Convert FASTQ sequencing reads to FASTA while preserving headers and sequence case by default.
Convert GenBank records to FASTA by extracting primary sequences, CDS, or translations.
Translate DNA sequences into proteins across reading frames and genetic code tables.
Convert coding-strand DNA to RNA notation by replacing thymine with uracil.
Reverse translate protein sequences into DNA with codon optimization and GC-content controls.