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

Document

TXT Plain Text

最も汎用的なプレーンテキスト形式。固定のバイナリシグネチャはありません。

Extensions .txt, .text
MIME text/plain

マジックナンバー

ファイルを解析
オフセット 0 このサイトのTXTサンプルで使う先頭行
74 69 74 6C 65 3A
title:

構造

  1. Text lines
  2. Optional metadata
  3. Line endings

注意点

  • TXT一般には固定マジックナンバーがなく、文字コードや改行コードも一定ではありません。

判定コード例

SIGNATURE = bytes.fromhex("7469746c653a")
OFFSET = 0

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

実践的な使い方

ユースケース

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

よくある判定ミス

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

セキュリティ上の注意

文書形式はスクリプト・添付・マクロ・外部参照を含むことがあります。プレビューや変換はサンドボックス化し、信頼できないファイルを直接開かないでください。

サンプルの活用

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

サンプルファイル

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

Blue Sky TXT

Blue Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.txt
Type Sample
Small file
164 B
SHA-256 b4ef7c269237079163ffb2047223ccee7efdfe3317e9f2c941e8a9658ca7322d
Download
Doc

Flower Garden TXT

Flower Garden TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.txt
Type Sample
Small file
252 B
SHA-256 4f930a8a4a98e9f60dd45685492ed5f269bed5779df51de835f4800fc8070ff0
Download
Doc

Navy Blue Sky TXT

Navy Blue Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.txt
Type Sample
Small file
266 B
SHA-256 56b479b44e4340cd4db9aa2772c1fbb48483217e0f9ed785a8d0cd2511f1d10b
Download
Doc

Nature of the Sky TXT

Nature of the Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.txt
Type Sample
Small file
302 B
SHA-256 13c9c17e777735a54d7ff404e6ef1c740d50cbbc073b26dfb6fa0a7eb5be8d12
Download
Doc

Sky Landscape TXT

Sky Landscape TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.txt
Type Sample
Small file
400 B
SHA-256 3d3498c21f5f508ea2581aba77104c0de05dba37d0f419efc5b3d4a4a0b5ec51
Download
Doc

Starry Sky TXT

Starry Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.txt
Type Sample
Small file
306 B
SHA-256 d5ab2b30d3fc9dc2e0cdb6bb5e06de8e6741be30f3a6889cfe7900d6416c1c32
Download
Doc

Blue Night Sky TXT

Blue Night Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.txt
Type Sample
Small file
398 B
SHA-256 d3a6fc8972af9b1cad31d5657ff4e8632c509e906316d226621ebce3d0b79e3b
Download
Doc

Hibiscus Flower TXT

Hibiscus Flower TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.txt
Type Sample
Small file
567 B
SHA-256 48177ae9a99604b1c63b6bc18a020bfecf0b3b43955bb4fa444ac885817b36ff
Download
Doc

Arctic Sky TXT

Arctic Sky TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.txt
Type Sample
Small file
473 B
SHA-256 467cb5ad3ddb4094ad1b73ec6afeff908cd0f01054318532ff6a7230dd689a62
Download
Doc

Sunset Rays TXT

Sunset Rays TXT is a Plain Text sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.

10-sunset-rays.txt
Type Sample
Small file
523 B
SHA-256 6b35d7b14f369167402135c26254c67f01d2c0cd3e154de7398d8b030aa0109a
Download
Doc

NASA Blue Marble TXT

NASA Blue Marble TXT is a Plain Text 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.txt
Type Sample
1.0 KB
SHA-256 9a5f65a9e7e5c69a1b0c66721d65dcacc3376c326454dd931a4724a0be3c7f87
Download

よくある質問

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

Plain Text ファイルはバイトシグネチャ 74 69 74 6C 65 3A ("title:") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Plain Text のMIMEタイプは?

Plain Text のMIMEタイプは text/plain です。

Plain Text の拡張子は?

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

関連フォーマット