filesdataFormats and data

01 / Formats

An extension is not the whole format

Tell names, contents and containers apart, and understand why a file may fail to open even when its extension looks familiar.

Name, MIME type and contents

An extension is the part of a name after its last dot: .csv, .png, .mp4. It helps an application choose how to open the file, but it does not reliably describe the contents. Anyone can rename a file. Conversion requires reading the source format and writing the destination format, not replacing letters in the name.

A MIME type is a label for exchanging data, such as image/png. The label can also be wrong. A signature near the start can identify many binary formats, but it is not a safety check. Formats can share a container: ZIP underlies DOCX, so a similar header does not explain the purpose of the whole package.

Text, encodings and tables

Plain TXT has no universal mandatory encoding marker. The same bytes can look different when read as UTF-8 or as a legacy single-byte encoding. If the text is garbled, try opening a copy with the correct encoding. Do not overwrite the only original before checking.

CSV stores records and fields, not workbook formatting. RFC 4180 describes comma-separated fields; fields containing a comma, quote or line break are double-quoted. A double quote inside a quoted field is doubled.[1]

title,note
Lamp,"desk, warm light"
Book,"marked ""to read"""

In practice, delimiters, line endings and encodings vary. Choose the delimiter explicitly on import. Import identifiers such as 0017 as text to preserve leading zeros. Unfamiliar CSV files can contain values that spreadsheet software interprets as formulas.

JSON describes structure: objects, arrays and values. RFC 8259 requires UTF-8 for exchange between systems. Standard JSON has neither comments nor a trailing comma after the final item.[2] Valid syntax does not prove that the expected fields and types are present.

Raster and vector

PNG, JPEG and WebP store raster images: grids of pixels. Increasing their dimensions cannot restore absent detail. PNG compresses losslessly; conventional JPEG trades some information for smaller files. WebP supports both approaches, so the extension alone does not tell you the quality.

SVG describes paths, fills and text. Drawings can scale, but they may also contain embedded raster images, external links and active content. Clean or safely convert an untrusted SVG before publishing it. A vector format does not guarantee a small file.

Documents and portability

PDF fixes page layout, but it can contain a scan with no text layer, attachments, forms and other elements. Selectable text, reading order and accessibility need separate checks. Preservation depends on the profile, embedded fonts and validity of the actual document, not the extension alone.

DOCX retains editable structure. Pages may change when a font is missing or a different application opens the file. A PDF export can accompany the editable source when the recipient needs both review and revision. Check comments, tracked changes and document properties before sharing.

Containers and compression

A container organises parts of a file; a codec defines how a media track is encoded. An MP4 may contain H.264 video and AAC audio, but that is not the only combination. Playback needs support for both the container and the particular tracks.[3]

TAR collects files, gzip compresses a stream, and ZIP combines a container with per-entry compression. That makes .tar.gz a meaningful pair of suffixes, not two competing formats. Choose a format by first deciding whether you need an editable source, a viewable output or a preserved collection.

Audio and video

WAV is a container: it often holds uncompressed PCM, but other codecs are possible. To assess size and quality, inspect the sample rate, bit depth, channel count and actual codec. MP3 is normally used for compact lossy audio; converting MP3 to WAV cannot restore discarded information.

For video, also inspect frame dimensions, frame rate and encoding. An MP4 with a supported codec may play where an MP4 with a different profile does not. WebM does not identify one fixed set of codecs either.[3] Before sharing, test the film on the target device and retain a source for future exports.

Sources