file in abyss
フォーマット一覧へ戻る

Web

HTML HyperText Markup Language

Webページの標準マークアップ形式。多くのHTML文書は<!doctype html>や<html>から始まります。

Extensions .html, .htm
MIME text/html

マジックナンバー

ファイルを解析
オフセット 0 HTML5 doctype
3C 21 64 6F 63 74 79 70 65
<!doctype

構造

  1. Doctype
  2. html
  3. head
  4. body

注意点

  • HTMLは空白、コメント、BOM、サーバー生成断片などで始まる場合もあります。

判定コード例

SIGNATURE = bytes.fromhex("3c21646f6374797065")
OFFSET = 0

def is_html(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

HyperText Markup Language はデータ交換、インポート/エクスポート、パーサのテスト、検証ワークフローで使われます。エンコーディング・区切り文字・バージョン・コンテナ構造が実装の挙動を変えることがあります。

よくある判定ミス

  • .html / .htm という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • HyperText Markup Language は 3C 21 64 6F 63 74 79 70 65 のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

形式が判定できたからといって、信頼できない入力が安全とは限りません。パーサ例外・巨大ファイル・想定外のエンコーディング・外部参照を考慮してください。

サンプルの活用

11 個のサンプルで、先頭バイト判定・パーサのエラー・アップロード上限・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Web

Blue Sky HTML

Blue Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.html
Type Sample
Small file
347 B
SHA-256 3da0e54ffe7186921d2a037219ac03b1327b7577620940026310443163313586
Download
Web

Flower Garden HTML

Flower Garden HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.html
Type Sample
Small file
377 B
SHA-256 15223cb4d9e7c636861b0b5962036ead59ae9cddc063a0107e6023659047881f
Download
Web

Navy Blue Sky HTML

Navy Blue Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.html
Type Sample
Small file
369 B
SHA-256 1744f855eb8576d2a4214de31d8e8d3bfdd10a74a859d59fa9beef5ac5ddba5b
Download
Web

Nature of the Sky HTML

Nature of the Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.html
Type Sample
Small file
365 B
SHA-256 b35642842f3519ebfeff7568034fbda82b01eaa8c9a01b09f7469d1c52fe348b
Download
Web

Sky Landscape HTML

Sky Landscape HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.html
Type Sample
Small file
372 B
SHA-256 d50339721c2fbfcc006ae76b198de485d019103bb70bd58fbfdef43f224fd6c8
Download
Web

Starry Sky HTML

Starry Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.html
Type Sample
Small file
352 B
SHA-256 2a154d8e8e02c49a0483645749ee5d7078f143a9d66ceff82aeaf2c29eda3e08
Download
Web

Blue Night Sky HTML

Blue Night Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.html
Type Sample
Small file
356 B
SHA-256 c2587341751a1e1e84dc0faf4faf3fac8a7b299635aeabc79ef38a7381f0d682
Download
Web

Hibiscus Flower HTML

Hibiscus Flower HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.html
Type Sample
Small file
384 B
SHA-256 6e078c2a2cff9855876aa42f18abdfb7113a8455794c9a44aabaa9af58ff6d2c
Download
Web

Arctic Sky HTML

Arctic Sky HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.html
Type Sample
Small file
360 B
SHA-256 68603539b4b96df6f2131a7cc875e66f8b91cae9a7dba52202429c5efb52798c
Download
Web

Sunset Rays HTML

Sunset Rays HTML is a HyperText Markup Language sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

10-sunset-rays.html
Type Sample
Small file
358 B
SHA-256 4637d3e25d6f3da6144f5d06afe94380772515c4c57080c1d77232a6335af455
Download
Web

NASA Blue Marble HTML

NASA Blue Marble HTML is a HyperText Markup Language sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.html
Type Sample
Small file
410 B
SHA-256 f7cee2a714ce3bf7b25a8dbeb549df87ffbe6b43accc032186bca5cc84e6fcc9
Download

よくある質問

HyperText Markup Language のマジックナンバー(ファイルシグネチャ)は?

HyperText Markup Language ファイルはバイトシグネチャ 3C 21 64 6F 63 74 79 70 65 ("<!doctype") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

HyperText Markup Language のMIMEタイプは?

HyperText Markup Language のMIMEタイプは text/html です。

HyperText Markup Language の拡張子は?

HyperText Markup Language ファイルは .html, .htm 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット