A header is a part of a document or data packet that carries metadata or other information necessary for processing the main data. It is a widely used term in information technology that refers to any supplemental data that are placed before the actual data. The header usually marks the start of the data. When data are transmitted in datagrams, the header holds the important data such as the source and destination address, packet type and size, and related details. Similarly, the header is used in different types of documents for specific purposes.
A header is a part of a document, data packet or message that contains important information that is supplementary to the actual data. The contents of the header differ from document to document. Below are some examples of header contents:
- Email: The email header precedes the text message contained in an email. It contains information such as the sender, recipient, subject, timestamp and other related details.
- HTTP message: Every message sent via the HTTP protocol includes a header that contains details about the content type, HTTP version, user agent, etc.
- Data packet: The header part of a data packet transmitted over the Internet includes information about the payload type, sequence number, IP addresses of the sender and receiver, etc.
- Word processing documents: The header of a word processing document is used for adding extra details such as the author's name, number of pages, date, etc.
- Graphics files: The header of a graphics file contains information about the image size (width and height), depth, resolution, format, number of colors, etc.
- Archive/binary file: The header of an archive or binary file acts as a signature that identifies the file format and compatible software that can be used to open/edit the file.
- Program source code: Header files are used to insert certain processing information and/or assembly files into a source file.
- HTML document: The header section, which is defined by the <head> tag, is used to hold metadata and the title of the html document.
Depending on the application, a header may be either optional (e.g., HTML document) or mandatory (e.g., data packet). It serves many purposes such as identification, authentication, verification, etc. The header of a data packet may also be used for tracing the path of the data packet from the sender to the receiver.