Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:FITS

From ReverseEngineering.wiki
Format
Magic SIMPLE = T
Extensions .fits, .fit, .fts
Endianness big-endian data
On this wiki Facts · Code · Notes · Topics

Flexible Image Transport System, the astronomy file format: a file is a sequence of HDUs made of 2880-byte blocks, each header being 80-character ASCII cards beginning with SIMPLE = T and ending with an END card.

Overview

Every FITS file is a series of Header Data Units (HDUs). The primary HDU comes first; extensions (IMAGE, TABLE, BINTABLE) follow. Both headers and data are padded to a multiple of 2880 bytes.

Identification

The first card is SIMPLE = T (the keyword padded to 8 characters, = at columns 9 and 10, the logical value right-justified in column 30). Extension HDUs start with XTENSION. See Fact:FITS/magic/SIMPLE card signature.

Header cards

A header is a run of 80-character ASCII cards (keyword of up to 8 characters, = , value, optional / comment) terminated by an END card and space-padded to 2880 bytes. Commentary keywords are COMMENT, HISTORY and blank; long keywords use the HIERARCH convention and long strings the CONTINUE convention. See Fact:FITS/behavior/Blocks, cards and BITPIX.

Data

BITPIX gives the element type: 8, 16, 32, 64 (integers) and -32, -64 (IEEE floats), stored big-endian (Unverified: byte order not read in astropy for this page). NAXIS and NAXISn give the dimensions.

Code & repositories

astropy (BSD-3-Clause) is the reference Python reader. The FITS standard 4.0 is the specification. Unverified: the standard's exact wording was not read for this page; the facts come from astropy source.

  • https://github.com/astropy/astropy @ a64a40bae76a201629e73ac0de0b1b85c353264a · license: BSD-3-Clause
    Python FITS reader; astropy/io/fits holds card, header and HDU parsing
    Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-18