Examples of text files
The following are all examples of text files (with their common file extensions):
| type of text file | file extension |
|---|---|
| plain text | .txt |
| HTML | .html |
| Python | .py |
| Java source code | .java |
| Markdown | .md |
| Javascript | .js |
| comma separated values | .csv |
| numerical data | .dat |
| JSON format data | .json |
| SVG image | .svg |
The important thing is not that they contain text (words and sentences) but that they are encoded as text.
Remember that the file extension is just part of the filename: it does not automatically affect the format of its contents, so it is technically possible for a file ending in
.txtto not be a text file. You can call your dog “cat”, but… it’s still a dog.
The following are all examples of files which are not text files (they are sometimes called binary files):
| type of binary file | file extension |
|---|---|
| Word document | .doc, .docx |
| Zip archive | .zip |
.pdf |
|
| Image | .gif, .jpg, .png |
| Audio | .mp4 |
| Excel spreadsheet | .xls |