I am studying FITS file, through this: Definition of FITS

They said Fits block is like below(page3).

A sequence of 2880 eight-bit bytes aligned on 2880-byte boundaries in the FITS file, most commonly either a header block or a data block. Special records are another infrequently used type of FITS block. This block length was chosen because it is evenly divisible by the byte and word lengths of all known computer systems at the time FITS was developed in 1979.

It is hard to understand this concept because one HDU's data or header has more information than "2880 byte".

For example, one of the header's character exceed 2880, and 1 character is charged 1 byte.

What's the point I miss?

  • 3
    $\begingroup$ The header and the data each consist of one or more (usually more) blocks. (You can define the size and shape of an individual page for a book. But the book is allowed to have more than one page.) $\endgroup$ Commented Jul 10, 2022 at 10:18
  • 1
    $\begingroup$ @PeterErwin Thank you for comment. I want to ask what's the block part in header or data. Is it just one keyword in header and just one element in data? $\endgroup$
    – BAO
    Commented Jul 10, 2022 at 17:12
  • 2
    $\begingroup$ From the astropy io.fits documentation: "FITS headers must be written in 2880 byte blocks, large enough for 36 keywords per block (including the END keyword in the final block). Typical headers have somewhere between 1 and 4 blocks, though sometimes more." The blocks are a very low level of allocation; they don't correspond to individual keywords or elements of data. $\endgroup$ Commented Jul 10, 2022 at 17:26

1 Answer 1


In general computing, a 'block' is a data storage unit with a fixed total size / storing a fixed number of records. In essence it's just a 'section of' data. If the data exceed the size of a single block, they can be stored in multiple blocks. But the actual space taken up on disk will always be some multiple of the block size, because the FITS file 'allocates space' 2880 bytes at a time. If there's leftover space at the end, it's just left empty. Here's a helpful diagram, courtesy DIY Space Projects:

Image showing the header unit and data unit broken into 2880 byte blocks.

You can see that the entire header unit is stored over multiple blocks - if one section of the header exceeds the 2880 byte allocation, then another block is added on. (Note that the "END" text there is literal - the header officially ends once it reaches this marker, though it may still be padded out with empty space until it reaches 2880 units.) In your example, where you reach 2880 bytes and then have one extra character to store, that extra character 'costs' 2880 bytes on disk. The system does, in fact, need to allocate two blocks, and the second one will just store the last character (plus the END indicator).

To be honest, this is a fairly low-level detail of the file format that most people don't need to know or interact with. It's a formality, originally used to make file reading and writing more effective on systems that had limitations we no longer regularly deal with. In general, if you are the consumer of a FITS file (or a consumer of a library that makes FITS files), you don't need to know the gritty details of how this works, because it's already abstracted away for you.

  • $\begingroup$ Thank you for your comment. I have one more question. "Data unit" also can have multiple blocks? (I wonder because in the picture you uploaded, "data unit" seems like it has only one block) $\endgroup$
    – BAO
    Commented Jul 16, 2022 at 10:11
  • 1
    $\begingroup$ @BAO The data unit can have multiple blocks, yes. $\endgroup$
    – Slate
    Commented Jul 19, 2022 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .