Format Conversion


twoBitToFa input.2bit output.fa


This tool is part of UCSC Genome Browser's Utility Tools.


  • -seq=name: restrict this to just one sequence
  • -start=X: start at given position in sequence (zero-based)
  • -end=X: end at given position in sequence (non-inclusive)
  • -seqList=file: file containing list of the desired sequence names in the format seqSpec[:start-end], e.g. chr1 or chr1:0-189 where coordinates are half-open zero-based, i.e. [start,end)
  • -noMask: convert sequence to all upper case
  • -bpt=index.bpt: use bpt index instead of built in one
  • -bed=input.bed: grab sequences specified by input.bed. Will exclude introns
  • -bedPos: with -bed, to use chrom:start-end as the fasta ID in output.fa
  • -udcDir=/dir/to/cache: place to put cache for remote bigBed/bigWigs

Sequence and range may also be specified as part of the input file name using the syntax:

/path/input.2bit:name or /path/input.2bit:name or /path/input.2bit:name:start-end


Assume you have a sequence file in 2bit format, and you want to extract sequence for chr1 from that file:

twoBitToFa -seq=chr1 -udcDir=. stdout > genome.chr1.fa

Share your experience or ask a question