Skip to content

GoogleWebP image file (.webp)

.webp file signature | image/webp

Google WebP image file, where ?? ?? ?? ?? is the file size. More information onWebP File Header

Safe

Magic Bytes

Offset 0
52 49 46 46 57 45 42 50

Sources: Wikipedia, Gary Kessler

All Known Signatures

3 signature variants are documented for .webp files across multiple sources.

Hex Signature Offset Sources
52 49 46 46 57 45 42 50 0 Wikipedia, Gary Kessler
52 49 46 46 2E 2E 2E 2E 57 45 42 50 0 Apache Tika
57 45 42 50 0 Neil Harvey FileSignatures

Extension

.webp

MIME Type

image/webp

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .webp files in Python

Python
def is_webp(file_path: str) -> bool:
    """Check if file is a valid WEBP by magic bytes."""
    signature = bytes([0x52, 0x49, 0x46, 0x46, 0x57, 0x45, 0x42, 0x50])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .webp files in Node.js

Node.js
function isWEBP(buffer: Buffer): boolean {
  const signature = Buffer.from([0x52, 0x49, 0x46, 0x46, 0x57, 0x45, 0x42, 0x50]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .webp files in Go

Go
func IsWEBP(data []byte) bool {
    signature := []byte{0x52, 0x49, 0x46, 0x46, 0x57, 0x45, 0x42, 0x50}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .webp file?

A .webp file is a GoogleWebP image file file. Google WebP image file, where ?? ?? ?? ?? is the file size. More information onWebP File Header

What are the magic bytes for .webp files?

The magic bytes for GoogleWebP image file files are 52 49 46 46 57 45 42 50 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .webp file?

To validate a .webp file, read the first bytes of the file and compare them against the known magic bytes (52 49 46 46 57 45 42 50) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .webp files?

The primary MIME type for .webp files is image/webp.

Is it safe to open .webp files?

GoogleWebP image file (.webp) 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.