Skip to main content
v2026.11,986 entries · CC-BY 4.0

GFF File Format: Guide to GFF3 Syntax, Features, and Validation

A comprehensive guide to the GFF file format, covering 9-column GFF3 syntax, 1-based coordinates, parent-child feature hierarchies, and conversion workflows.

Written and maintained by CASRAI Editorial Board

Published

On this page

A GFF file (General Feature Format, currently standardized as GFF3) is a tab-delimited plain-text bioinformatics file used to record the positions, structural boundaries, and functional attributes of biological features along a genomic, transcriptomic, or proteomic sequence. Operating on a 1-based, fully inclusive coordinate system, each GFF line details a discrete genomic landmark—such as a gene, mRNA transcript, exon, coding sequence (CDS), or regulatory region—using nine standardized columns. Rather than storing the underlying nucleotide sequences themselves, a GFF file serves as an annotation index that links sequence coordinates to controlled biological vocabularies and hierarchical gene models.

Definition and Genomic Scope of GFF Files

The General Feature Format was initially created in 1997 by Richard Durbin and Lincoln Stein at the Wellcome Sanger Institute to address the fragmentation of genomic sequence annotations. Early genome databases relied on complex, ad-hoc relational schemas or flat GenBank files that were difficult to parse with standard Unix command-line utilities. GFF introduced a lightweight, tab-delimited table format that bioinformaticians could inspect with standard text editors and process using core command-line tools like grep, awk, and sort.

As genome sequencing expanded to complex multicellular eukaryotes, the original GFF specifications (GFF1 and GFF2) proved inadequate for representing multi-exon genes with alternative splicing isoforms. Because GFF2 lacked a standardized syntax for multi-level feature hierarchies, different database consortia invented conflicting group tags. In response, Lincoln Stein and the Sequence Ontology consortium developed the GFF3 specification (version 1.26), which establishes strict constraints on feature hierarchies, controlled vocabularies, and character encoding.

In modern genomics, GFF3 files serve as the universal data exchange medium for annotated genomes. They capture a wide spectrum of biological entities, including protein-coding genes, long non-coding RNAs (lncRNAs), microRNAs (miRNAs), transfer RNAs (tRNAs), transposable elements, CpG islands, transcription factor binding sites, open chromatin peaks, and CRISPR target regions. By decoupling coordinate annotations from primary sequence storage, GFF files allow researchers to overlay multiple independent layers of experimental data onto a shared reference genome assembly.

The 9-Column GFF3 File Architecture

Every standard feature entry in a GFF3 file consists of exactly nine tab-delimited columns. Empty or inapplicable optional fields must contain a single dot character (.). No whitespace other than the single tab delimiter is permitted between columns.

Col Field Name Data Type Syntax and Value Constraints Practical Example
1 seqid String Landmark chromosome, scaffold, or contig ID. Unescaped whitespace is prohibited. chr1 or NC_000001.11
2 source String The program, pipeline, or repository that generated the feature. Ensembl, AUGUSTUS, or NCBI
3 type String Must be a valid term or accession from the Sequence Ontology (SO/SOFA). gene, mRNA, exon, or CDS
4 start Integer 1-based inclusive start coordinate; must be positive and less than or equal to end. 1000
5 end Integer 1-based inclusive end coordinate; must be positive and greater than or equal to start. 2500
6 score Float E-value, P-value, or alignment score; dot (.) if not evaluated or absent. 42.8 or .
7 strand Character Genomic orientation: + (forward), – (reverse), . (unstranded), or ? (unknown). +
8 phase Integer Mandatory for CDS features (0, 1, or 2); dot (.) for all non-coding features. 0
9 attributes String Semicolon-separated list of tag=value pairs; tags are case-sensitive. ID=gene01;Name=BRCA1

The individual columns enforce strict biological semantics that distinguish GFF3 from generic coordinate formats:

  • Column 1 (seqid): Identifies the reference sequence landmark. Coordinate systems are anchored to this sequence identifier, which must match the FASTA defline identifier used during read mapping.
  • Column 2 (source): Records the provenance of the annotation, such as an ab initio gene predictor (e.g., GeneMark, AUGUSTUS), an evidence-based alignment pipeline (e.g., StringTie, MAKER), or an authoritative genome database (e.g., Ensembl, RefSeq).
  • Column 3 (type): Rather than allowing arbitrary user strings, GFF3 mandates terms or numeric accessions from the Sequence Ontology (SO). For example, a protein-coding transcript must be labelled mRNA (SO:0000234), not transcript or RNA.
  • Columns 4 and 5 (start and end): Define the physical interval on the landmark sequence. GFF3 coordinates are 1-based and fully closed, meaning that both the start and end positions are included within the annotated feature. A single-base feature has identical start and end values (e.g., start 500, end 500).
  • Column 6 (score): Stores numerical confidence metrics. For gene predictions, this may represent posterior probability; for sequence similarity matches, it frequently holds BLAST bit scores or e-values.
  • Column 7 (strand): Indicates transcription direction relative to the reference landmark. Reverse-strand features (-) possess start coordinates that remain numerically smaller than end coordinates; the strand flag directs parsers to read reverse-complement triplets during in silico translation.
  • Column 8 (phase): Indicates the reading frame offset for coding sequence (CDS) features. The phase indicates the number of bases (0, 1, or 2) that must be removed from the 5′ beginning of the CDS segment to reach the first base of the next complete codon.
  • Column 9 (attributes): Contains structured metadata using tag=value syntax. Multiple values for a single tag are separated by commas. Predefined reserved tags begin with uppercase letters, whereas custom or tool-specific tags must begin with lowercase letters.

Pragmas, Directives, and Parsing Conventions

GFF3 files use structured directives, called pragmas, to communicate file-level metadata and parsing boundaries. Directives begin with a double hash (##) and must precede any feature lines that rely on them.

The very first line of every valid GFF3 file must be the explicit version pragma:

##gff-version 3

Parsers encounter several key standard directives throughout GFF3 streams:

  • ##sequence-region seqid start end: Declares the coordinate bounds of a landmark sequence. This allows streaming parsers to detect truncated files or verify that features do not extend past chromosome ends.
  • ### (Forward Reference Closure): A triple hash pragma indicates that all subfeatures belonging to preceding multi-level features have been fully declared. In high-throughput pipelines, this directive enables memory-efficient streaming without buffering entire chromosome trees.
  • ##species Taxonomy-URL: Specifies the biological organism associated with the annotations, facilitating automated taxonomy mapping.
  • ##FASTA: Placed at the very end of a GFF3 file, this directive signals that all subsequent lines contain raw nucleotide or amino acid sequences in standard FASTA format.

Character encoding within GFF3 files follows RFC 3986 percent-encoding standards. Any literal tab (%09), newline (%0A), carriage return (%0D), semicolon (%3B), equals sign (%3D), or comma (%2C) appearing within column values must be escaped to prevent corrupting the tabular grammar.

Hierarchical Feature Relationships and Parent-Child Modeling

The primary architectural strength of GFF3 is its ability to represent arbitrary, multi-level biological hierarchies using the reserved ID and Parent attribute tags in Column 9. An individual feature declares its unique identity using ID=unique_id and links to its enclosing biological structure using Parent=parent_id.

Consider a standard eukaryotic gene model encoding two alternatively spliced mRNA transcripts. The structural hierarchy is organized across three tiers:

  1. Gene Tier: The top-level gene feature spans the entire transcribed locus from the earliest transcription start site to the latest polyadenylation site. It carries a unique ID (e.g., gene:ENSG000001) and has no Parent.
  2. Transcript Tier: One or more mRNA features span the boundaries of individual spliced isoforms. Each transcript carries a unique ID and declares Parent=gene:ENSG000001.
  3. Sub-Transcript Tier: Discrete exon, CDS, five_prime_UTR, and three_prime_UTR features declare the transcript ID as their Parent. If an exon is shared identically between multiple transcript isoforms, its Parent attribute lists both parent IDs separated by a comma (e.g., Parent=mRNA:01,mRNA:02).

A standard GFF3 representation illustrating this hierarchy appears as follows:

##gff-version 3
chr1 AUGUSTUS gene 1000 9000 . + . ID=gene01;Name=MYC
chr1 AUGUSTUS mRNA 1000 9000 . + . ID=mRNA01;Parent=gene01;Name=MYC-201
chr1 AUGUSTUS five_prime_UTR 1000 1150 . + . ID=utr5_01;Parent=mRNA01
chr1 AUGUSTUS exon 1000 1500 . + . ID=exon01;Parent=mRNA01
chr1 AUGUSTUS CDS 1151 1500 . + 0 ID=cds01;Parent=mRNA01
chr1 AUGUSTUS exon 4000 5000 . + . ID=exon02;Parent=mRNA01
chr1 AUGUSTUS CDS 4000 4600 . + 2 ID=cds02;Parent=mRNA01
chr1 AUGUSTUS three_prime_UTR 4601 5000 . + . ID=utr3_01;Parent=mRNA01

In this hierarchy, notice that the CDS phase for the first coding segment is 0 because translation starts immediately at coordinate 1151. The length of the first coding segment is 1500 – 1151 + 1 = 350 nucleotides. Dividing 350 by 3 leaves a remainder of 2 nucleotides. Therefore, the second coding exon requires 3 – 2 = 1 base to complete the split codon, giving it a starting phase of 2.

Coordinate Systems: 1-Based Inclusive vs 0-Based Half-Open

A frequent source of pipeline failure in genomic analysis is coordinate system mismatch. GFF3 operates strictly on a 1-based, fully closed coordinate system. In this convention:

  • The first nucleotide of a chromosome or scaffold is numbered 1.
  • Both the start and end positions are included within the feature interval.
  • The total length of a feature is calculated as: length = end - start + 1.

This contrasts directly with the 0-based, half-open coordinate system used by the BED file format and standard indexing libraries like BAM/CRAM. In a 0-based half-open system, counting begins at 0, the start coordinate is included, but the end coordinate is excluded (non-inclusive). In BED files, feature length is calculated simply as length = end - start.

When translating coordinates between GFF3 and BED:

  • GFF3 to BED: start_BED = start_GFF - 1; end_BED = end_GFF.
  • BED to GFF3: start_GFF = start_BED + 1; end_GFF = end_BED.

Failing to account for this 1-base offset when converting annotation files causes systematic frame-shift errors, off-by-one splice junction calculations, and incorrect nucleotide extractions from reference FASTA files.

Bioinformaticians frequently encounter three primary flat-file formats for genomic annotations: GFF3, GTF (Gene Transfer Format / GFF2), and BED. While they appear visually similar as tab-delimited tables, their design objectives and structural capabilities differ significantly.

As explored in our detailed GTF versus GFF3 comparison, GTF is a specialized derivative of GFF2 tailored specifically for protein-coding gene models in RNA sequencing analysis. GTF strictly mandates gene_id and transcript_id attributes enclosed in quotes and separated by semicolons (for example, gene_id "ENSG01"; transcript_id "ENST01";). However, GTF lacks support for arbitrary multi-level hierarchies, non-coding ontologies, and multi-parent grouping.

The comparative data table below systematically compares the structural boundaries, coordinate mechanics, and feature constraints of these formats alongside variant annotation standards.

Where GFF Files Matter in Bench Science and Genomic Pipelines

In wet-lab genomics and translational research facilities, GFF files are indispensable across several core operational stages:

  • RNA-Seq Read Alignment: Splicing-aware aligners like the STAR RNA-seq aligner ingest GFF3 or GTF files during genome index generation. By supplying verified exon-intron boundaries beforehand, researchers dramatically increase mapping sensitivity across unannotated or rare splice junctions.
  • Transcript Quantification: Downstream counting utilities, including HTSeq read counting and featureCounts quantification, intersect aligned BAM alignments with GFF feature boundaries to compute raw read counts per gene, transcript, or exon.
  • Genome Visualization: Visual genome browsers such as Integrative Genomics Viewer (IGV) and JBrowse parse sorted, indexed GFF3 files to render interactive track models showing spliced transcript structures, regulatory promoter elements, and coding sequences.
  • Variant Functional Annotation: Clinical and translational variant interpretation tools (such as Ensembl VEP and SnpEff) parse GFF feature models to determine whether newly identified single nucleotide variants, insertions, or deletions induce synonymous mutations, missense amino acid substitutions, or frameshift disruptions.

Step-by-Step Validation, Sorting, and Conversion Workflows

Raw GFF files produced by de novo gene prediction software or web downloads frequently contain syntax defects, unsorted coordinates, or non-standard attributes. To prepare a GFF3 file for downstream high-throughput pipelines, follow this standardized validation and indexing protocol:

  1. Validate GFF3 Syntax: Run an automated syntax validator to verify that all column types adhere to the Sequence Ontology and that parent-child relationships resolve cleanly. Tools such as GenomeTools (gt gff3validator) or the AGAT toolkit check for circular parentage, unescaped characters, and missing mandatory headers.
  2. Sort Coordinates Lexicographically and Numerically: Genome browsers and tabix indexing require features to be strictly sorted by landmark sequence name and start position:

    sort -k1,1 -k4,4n input.gff3 > sorted.gff3
  3. Block-Compress with BGZIP: Standard gzip compression does not support random-access querying. Compress the sorted file using block-sorting gzip from HTSlib:

    bgzip sorted.gff3
  4. Generate Tabix Index: Build a tabix coordinate index file (.tbi) specifying the 1-based GFF preset:

    tabix -p gff sorted.gff3.gz
  5. Convert to GTF When Required: Many legacy RNA-seq counting tools require strict GTF2 syntax rather than GFF3. Use gffread to convert hierarchies cleanly without losing transcript associations:

    gffread sorted.gff3 -T -o output.gtf

Common Misunderstandings and Validation Errors

Working with GFF3 files frequently introduces operational snags. Recognizing and diagnosing these standard errors prevents downstream analysis pipeline crashes:

  • Confusing Phase with Reading Frame: Phase is not synonymous with reading frame. Reading frame denotes the codon position relative to the overall transcript sequence (frame 1, 2, or 3), whereas phase indicates how many bases (0, 1, or 2) must be skipped at the start of a specific CDS feature line to reach the next full codon.
  • Unencoded Delimiters in Column 9: If an annotation attribute value contains a literal semicolon, equals sign, or comma (such as Note=Kinase, receptor; putative), naive parsers split the string into corrupt key-value pairs. Semicolons and commas within values must be escaped as %3B and %2C.
  • Orphaned Subfeatures: If an exon or CDS record declares a Parent=mRNA01 that does not exist elsewhere in the file (or appears after the subfeature without proper pragma closure), strict parsers discard the subfeature or terminate with fatal errors.
  • Ad-Hoc Feature Types in Column 3: Substituting non-SO terms like transcript_region or promoter_site violates the GFF3 standard. If an ontology term is unavailable, bioinformaticians must use generic fallback SO terms like sequence_feature (SO:0000110).
  • Chromosome Naming Inconsistencies: Aligning reads to a reference containing prefix designations (e.g., chr1) while using an annotation file with bare numeric accessions (e.g., 1 or NC_000001.11) results in 0% read assignment during quantification. Ensure the seqid column exactly matches your alignment reference headers.

Frequently asked questions

What is the structure of a GFF file?

A GFF file is a tab-delimited plain-text file consisting of nine standardized columns: seqid (landmark identifier), source (generating program or database), type (Sequence Ontology term), start (1-based start coordinate), end (1-based end coordinate), score (numeric evaluation or dot), strand (+, -, ., or ?), phase (reading frame offset for CDS: 0, 1, or 2), and attributes (semicolon-delimited tag=value pairs providing feature IDs and hierarchical relationships).

What is the difference between GFF and GFF3?

GFF (specifically GFF1 and GFF2) was an early specification that lacked formal mechanisms for representing multi-level feature hierarchies and did not restrict feature types to a controlled vocabulary. GFF3 resolved these issues by requiring the ##gff-version 3 header, enforcing Sequence Ontology terms in Column 3, standardizing explicit ID and Parent attribute tags in Column 9 to model complex gene models, and establishing RFC 3986 URL percent-encoding rules.

What is the difference between a GFF file and a GTF file?

While both formats share a 9-column tab-delimited layout, GTF (Gene Transfer Format) is a restricted derivative of GFF2 tailored for gene expression pipelines. GTF requires Column 9 attributes to use quoted key-value syntax with space delimiters (gene_id “value”; transcript_id “value”;). GFF3 uses unquoted tag=value pairs separated by semicolons and supports arbitrary, multi-level parent-child hierarchies that GTF cannot accommodate.

How do you open or view a GFF file?

Because GFF files are plain text, small files can be opened and inspected with standard command-line tools (such as head, less, awk, or grep) and code editors. For biological inspection, whole-genome GFF3 files should be sorted, block-compressed with bgzip, indexed with tabix, and loaded as visual tracks into genome browsers like Integrative Genomics Viewer (IGV), JBrowse 2, or the UCSC Genome Browser.

What coordinate system does a GFF file use?

A GFF file uses a 1-based, fully inclusive coordinate system. Counting starts at 1 for the first nucleotide of the reference landmark, and both the start and end positions are included within the feature interval. Feature length is calculated as end – start + 1. This contrasts with BED files, which use 0-based, half-open indexing where the start is included but the end coordinate is excluded.

How do you calculate phase for CDS features in a GFF file?

Phase indicates the number of bases (0, 1, or 2) that must be removed from the 5′ beginning of a CDS segment to reach the first base of the next full codon. For the initial coding exon containing the start codon, phase is 0. For each subsequent coding exon, the phase is calculated using the formula: next_phase = (3 – ((cds_length – current_phase) mod 3)) mod 3. For features on the minus strand, the 5′ start of translation corresponds to the feature end coordinate.

Sources

Data: Genomic Feature and Annotation File Formats Comparison

Comparative technical specifications of standard genomic annotation and feature file formats, detailing coordinate indexing bases, boundary rules, column counts, feature typing authorities, and hierarchy syntax. Compiled from official specifications published by the Sequence Ontology, Ensembl, UCSC Genome Browser, and NCBI GenBank.

Genomic Feature and Annotation File Formats Comparison
Format NameCoordinate BaseBoundary InclusivityStandard ColumnsFeature Typing StandardHierarchy MechanismAttribute Syntax
GFF3 (Generic Feature Format v3)1-basedFully closed [start, end]9 fixed columnsSequence Ontology (SO/SOFA terms and accessions)Explicit ID and Parent attribute tags supporting multi-level treestag=value pairs separated by semicolons, multiple values by commas
GTF 2.2 (Gene Transfer Format)1-basedFully closed [start, end]9 fixed columnsRestricted gene model set (gene, transcript, exon, CDS, start/stop_codon)Implicit grouping via shared gene_id and transcript_id stringstag "value" pairs separated by semicolons and whitespace
BED (Browser Extensible Data)0-basedHalf-open [start, end)3 to 12 columns (BED3, BED6, BED12)Unconstrained user-defined feature name in column 4Sub-feature block counts and relative starts in BED12 columns 10-12Fixed positional columns with no generic key-value attribute field
VCF 4.2 / 4.3 (Variant Call Format)1-basedFully closed [POS, POS+len-1] for standard calls8 fixed columns plus genotype sample columnsSequence Ontology terms for molecular consequence annotationsSingle-record variants; structural variants reference partner breaksSemicolon-separated KEY=VALUE pairs in INFO and colon-separated FORMAT
GVF 1.07 (Genome Variation Format)1-basedFully closed [start, end]9 fixed columns (GFF3 extension)Sequence Ontology variation terms (SO:0001060 and descendants)GFF3 ID and Parent tags linking variants to transcript modelsGFF3 tag=value syntax plus Variant_seq, Reference_seq, and Variant_effect

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about GFF File Format: Guide to GFF3 Syntax, Features, and Validation

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →