Skip to content

MS magic bytes (.ms)

.ms file signature: 2E 5C 22 | text/troff

The MS format is a troff macro package originally developed at AT&T Bell Laboratories and now maintained in modern troff implementations such as groff. It is used to structure technical documents, reports, and manuscripts for typesetting with troff-based systems. As a legacy text formatting format, it is generally safe to process, though it may rely on older document-processing tools that are less common in current workflows.

Safe

Magic Bytes

Offset 0
2E 5C 22

Sources: Apache Tika

All Known Signatures

5 signature variants are documented for .ms files across multiple sources.

Hex Signature Offset Sources
2E 5C 22 0 Apache Tika
27 5C 22 0 Apache Tika
27 2E 5C 22 0 Apache Tika
5C 22 0 Apache Tika
27 27 27 0 Apache Tika

Validation Code

How to validate .ms files in Python

Python
def is_ms(file_path: str) -> bool:
    """Check if file is a valid MS by magic bytes."""
    signature = bytes([0x2E, 0x5C, 0x22])
    with open(file_path, "rb") as f:
        return f.read(3) == signature

How to validate .ms files in Node.js

Node.js
function isMS(buffer: Buffer): boolean {
  const signature = Buffer.from([0x2E, 0x5C, 0x22]);
  return buffer.subarray(0, 3).equals(signature);
}

How to validate .ms files in Go

Go
func IsMS(data []byte) bool {
    signature := []byte{0x2E, 0x5C, 0x22}
    if len(data) < 3 {
        return false
    }
    return bytes.Equal(data[:3], signature)
}

API Endpoint

GET /api/v1/ms
curl https://filesignature.org/api/v1/ms

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .ms file?

A .ms file is identified by the magic bytes 2E 5C 22 at byte offset 0. The MS format is a troff macro package originally developed at AT&T Bell Laboratories and now maintained in modern troff implementations such as groff. It is used to structure technical documents, reports, and manuscripts for typesetting with troff-based systems. As a legacy text formatting format, it is generally safe to process, though it may rely on older document-processing tools that are less common in current workflows.

What are the magic bytes for .ms files?

The magic bytes for MS (.ms) files are 2E 5C 22 at byte offset 0. These bytes identify the file format more reliably than the extension alone.

How do I validate a .ms file?

To validate a .ms file, read the first bytes of the file and compare them against the known magic bytes (2E 5C 22) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .ms files?

The primary MIME type for .ms files is text/troff.

Is it safe to open .ms files?

MS (.ms) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.