Renaming a File Extension Doesn't Convert It

Renaming a File Extension Doesn't Convert It

You Renamed It to .jpg and It Still Won't Open

Someone sends you a photo from their iPhone. It's a .heic file and Windows Photos shrugs at it. So you do the obvious thing: rename it to photo.jpg. Windows warns you that the file might become unusable, you click through, and… it still doesn't open. Now it doesn't open and it's lying about what it is.

This is one of the most common misunderstandings about files, and it isn't a silly one. The extension is the only part of a file most of us ever see, so it's reasonable to assume it's what defines the file. It isn't.

The Extension Is a Label, Not the Contents

A file's real format lives in its bytes. Most formats announce themselves in the first few bytes of the file — a signature usually called a magic number. Open the files on your disk in a hex viewer and you'll find the same handful of patterns over and over:

Format First bytes As text
PNG 89 50 4E 47 0D 0A 1A 0A .PNG....
JPEG FF D8 FF E0 — (followed by JFIF)
PDF 25 50 44 46 2D 31 2E 37 %PDF-1.7
WEBP 52 49 46 4657 45 42 50 RIFFWEBP
ZIP 50 4B 03 04 PK..

When an application opens a file, that signature is what it trusts — not the name. Rename a PNG to photo.jpg and every tool that inspects it still reports a PNG, because every byte in it is still a PNG. The name changed; the file didn't.

The extension tells your operating system which program to launch. The bytes tell that program what it's actually looking at. When the two disagree, the bytes win — and the program tells you the file is corrupt.

Why the Error Message Is So Confusing

The application isn't lying to you when it says the file is damaged. From its point of view, it was handed something claiming to be a JPEG, it read the first bytes expecting FF D8 FF, and found something else entirely. "Corrupt" is a reasonable guess for a file whose header is wrong.

Windows makes this trap easier to fall into by hiding known extensions by default, so you can rename a file and not even see what it used to be. And because renaming occasionally appears to work — see below — the technique gets passed around as advice that seems to be true.

The Cases Where Renaming Really Is Fine

Renaming isn't always wrong. It's fine in exactly one situation: when the two extensions name the same format. Some formats simply have more than one customary spelling:

There's also a fun edge case that reveals how formats are built. A modern Office document is a ZIP archive with XML inside — its first bytes are PK, the same as any ZIP. Rename a .docx to .zip and your archive tool will open it and show you the document's internal structure. That works because you didn't change the format; you told the truth about it from a different angle.

What Converting Actually Does

Real conversion doesn't touch the name until the end. It:

  1. Decodes the source — turns the compressed HEIC back into actual pixels, or the PDF back into text, layout and images.
  2. Re-encodes that content into the target format's structure, with its own compression, its own header, its own rules.
  3. Writes a genuinely new file whose bytes match its extension, because the bytes were produced for that format.

That's why converting can involve choices — quality, resolution, codec — and renaming never does. There's nothing to decide when you're only editing a filename.

So What Do You Do Instead?

Convert it. If it's that iPhone photo, HEIC to JPG takes a few seconds and produces a file Windows opens without complaint. The same applies to everything else the rename trick is usually attempted on:

Conclusion

Renaming a file is a promise about its contents that nothing checks and nothing keeps. It costs you a second, and it either does nothing or leaves you with a file that misrepresents itself — which is worse than the problem you started with, because the next person to open it has no idea what it really is. Converting rewrites the contents so the name is true. It's the only version of this that survives contact with the program you're trying to open the file in.

Category: File Formats