Skip to content

Rich text format word processing fileTrailer:7D (.rtf)

.rtf file signature | application/rtf

Rich text format word processing fileTrailer:7D(})

Safe

Magic Bytes

Offset 0
7B 5C 72 74 66

Sources: Apache Tika, Gary Kessler

All Known Signatures

2 signature variants are documented for .rtf files across multiple sources.

Hex Signature Offset Sources
7B 5C 72 74 66 0 Apache Tika, Gary Kessler
7B 5C 72 74 66 31 0 Wikipedia, Neil Harvey FileSignatures

Extension

.rtf

MIME Type

application/rtf

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .rtf files in Python

Python
def is_rtf(file_path: str) -> bool:
    """Check if file is a valid RTF by magic bytes."""
    signature = bytes([0x7B, 0x5C, 0x72, 0x74, 0x66])
    with open(file_path, "rb") as f:
        return f.read(5) == signature

How to validate .rtf files in Node.js

Node.js
function isRTF(buffer: Buffer): boolean {
  const signature = Buffer.from([0x7B, 0x5C, 0x72, 0x74, 0x66]);
  return buffer.subarray(0, 5).equals(signature);
}

How to validate .rtf files in Go

Go
func IsRTF(data []byte) bool {
    signature := []byte{0x7B, 0x5C, 0x72, 0x74, 0x66}
    if len(data) < 5 {
        return false
    }
    return bytes.Equal(data[:5], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .rtf file?

A .rtf file is a Rich text format word processing fileTrailer:7D file. Rich text format word processing fileTrailer:7D(})

What are the magic bytes for .rtf files?

The magic bytes for Rich text format word processing fileTrailer:7D files are 7B 5C 72 74 66 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .rtf file?

To validate a .rtf file, read the first bytes of the file and compare them against the known magic bytes (7B 5C 72 74 66) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .rtf files?

The primary MIME type for .rtf files is application/rtf.

Is it safe to open .rtf files?

Rich text format word processing fileTrailer:7D (.rtf) 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.