vCard

How to Fix Corrupted VCF Files: Diagnose and Repair Damaged Contacts

Quick Answer

Open the VCF file in a text editor (Notepad++, VS Code) and check for the three most common corruption types: missing END:VCARD tags (add them back where contacts run together), truncated file (the file ends abruptly mid-contact), or null bytes (invisible characters that appear as NUL in hex view). Most corruption is fixable by editing the file structure in a text editor. If the file is too damaged, extract whatever contacts are readable and rebuild the rest from your original source.

Introduction

A corrupted VCF file might open in a text editor but contain garbled data. It might import into a contacts app with only half the contacts appearing. It might fail to import entirely with a vague error message. In all these cases, the file’s internal structure has been damaged in a way that prevents normal processing.

Corruption happens during file transfers (incomplete downloads, interrupted Bluetooth transfers), storage failures (damaged disk sectors, cloud sync conflicts), application bugs (software crashing mid-export), or manual editing mistakes (accidentally deleting a structural marker). This guide helps you identify the specific type of corruption in your file and fix it with targeted repair methods. If your file imports but produces errors on specific platforms, see our VCF import error guide instead, as that covers platform-level rejection rather than file-level damage.

Signs Your VCF File Is Corrupted

Before diagnosing the corruption type, confirm that the file is actually corrupted rather than simply incompatible with your platform. A corrupted file shows one or more of these symptoms: the file opens in a text editor but contains blocks of unreadable characters mixed with normal text, the contact count after import is significantly lower than expected, specific contacts appear with garbled names or missing all fields, the file size is unexpectedly small (suggesting truncation) or unexpectedly large (suggesting appended garbage data), or applications crash or hang when trying to open the file.

A file that is not corrupted but simply uses a different vCard version or encoding will show consistent behavior across all contacts rather than random failures. If every contact has garbled names, the issue is likely encoding rather than corruption. If only some contacts fail while others import correctly, the file likely has localized structural damage.

How to Diagnose the Type of Corruption

Open the file in Notepad++ or VS Code and run these diagnostic checks in order.

Check 1: Count BEGIN and END markers. Search for BEGIN:VCARD and END:VCARD. The counts should be equal. If BEGIN count exceeds END count, you have missing END tags. If END count exceeds BEGIN count, you have missing BEGIN tags or orphan END markers.

Check 2: Look at the file ending. Scroll to the very end of the file. The last line should be END:VCARD (possibly followed by a single empty line). If the file ends with a partial property, a Base64 fragment, or mid-word, it is truncated.

Check 3: Search for null bytes. In Notepad++, use Find with “Extended” search mode and search for \0. Any matches indicate null bytes that will break most VCF parsers. In VS Code, null bytes appear as small rectangles or question marks within otherwise normal text.

Check 4: Check the first bytes. The very first characters should be BEGIN:VCARD. If the file starts with EF BB BF (visible as odd characters before BEGIN), it has a UTF-8 BOM. If it starts with random binary data before the first BEGIN, the file has prepended garbage.

8 Types of VCF Corruption and How to Fix Each

Missing BEGIN/END Tags

When a BEGIN:VCARD or END:VCARD marker is missing, the parser cannot determine where one contact ends and the next begins. This typically causes two contacts to merge into one or all contacts after the break point to be lost. To fix: search for property sequences where one contact’s data flows directly into another’s without a separator. Insert END:VCARD and BEGIN:VCARD lines at the boundary. A VERSION line immediately following contact data (without an intervening END/BEGIN pair) is the clearest indicator of a missing boundary.

Truncated File

A truncated file ends abruptly, cutting off the last contact mid-property. This happens during interrupted file transfers or when storage runs out during export. The fix depends on severity. If the truncation point is between contacts (after an END:VCARD), the file is usable as-is with the last incomplete contact lost. If it is mid-contact, add the missing END:VCARD tag at the end of the file. The truncated contact will have incomplete data but all prior contacts will be recoverable.

Merged or Overlapping Contacts

Sometimes contacts overlap without clear boundaries: two FN properties in a row without END/BEGIN between them, or phone numbers from one person appearing in another contact’s block. This usually results from missing END:VCARD tags or from concatenating multiple VCF files without proper separators. Fix by identifying each logical contact (find each FN or N property) and inserting END:VCARD before and BEGIN:VCARD plus VERSION after each boundary where markers are missing.

Broken Base64 Photo Data

When Base64 photo data is truncated or contains invalid characters, the entire contact may fail to parse. Symptoms include import errors on specific contacts that have photos, or garbled data appearing after the photo block. The safest fix is to remove the broken PHOTO property entirely. Search for the PHOTO line, select it and all continuation lines (lines starting with a space), and delete them. See our photo removal guide for the exact regex pattern.

Null Bytes and Binary Garbage

Null bytes (\x00) are invisible characters that corrupt the text stream. They typically appear when a file is opened or saved with the wrong application (like opening a VCF in a binary editor and saving), during disk-level data recovery, or from concatenating files with incompatible line endings. Remove null bytes with sed: sed -i 's/\x00//g' contacts.vcf. In Notepad++ Extended mode, find \0 and replace with nothing.

BOM and Hidden Characters

A UTF-8 BOM (Byte Order Mark, bytes EF BB BF) at the start of the file prevents some parsers from recognizing the first BEGIN:VCARD. The file looks correct in a text editor, but the first contact fails to import. Remove the BOM with sed: sed -i '1s/^\xEF\xBB\xBF//' contacts.vcf. In Notepad++, go to Encoding menu and select “Convert to UTF-8” (without BOM). Other hidden characters like zero-width spaces (U+200B) and soft hyphens (U+00AD) can also cause parsing failures. Search for them using regex: [\x{200B}\x{00AD}\x{FEFF}].

Encoding Corruption (Mojibake)

Encoding corruption produces garbled characters (like “ü” instead of “u” with umlaut or “é” instead of “e” with accent). This happens when a UTF-8 file is re-saved as Windows-1252 or vice versa. Unlike structural corruption, encoding damage is reversible because the underlying bytes are intact. In Notepad++, go to Encoding menu, select “Character Sets” and try opening the file as different encodings until names display correctly. Then convert to UTF-8 and save. For a complete walkthrough, see our VCF encoding error guide.

Duplicate or Conflicting Properties

Some corruption introduces duplicate VERSION lines, multiple FN properties with different values, or repeated BEGIN:VCARD without a corresponding END. While most parsers tolerate minor duplication, excessive duplicates cause unpredictable behavior. Fix by searching for double occurrences within each contact block. Keep the first FN and VERSION, and delete duplicates. Multiple TEL or EMAIL properties are normal (contacts can have several phone numbers), but multiple N or FN properties within one contact are not.

Tools for Automated VCF Repair

For files with widespread damage across hundreds of contacts, manual repair is impractical. A Python script using the vobject library can attempt to parse each contact individually, skip contacts that fail, and write the valid contacts to a clean output file:

import vobject
with open('damaged.vcf') as f:
    text = f.read()
blocks = text.split('END:VCARD')
recovered = 0
with open('repaired.vcf', 'w') as out:
    for block in blocks:
        chunk = block.strip() + '\nEND:VCARD'
        if 'BEGIN:VCARD' not in chunk: continue
        try:
            card = vobject.readOne(chunk)
            out.write(card.serialize())
            recovered += 1
        except: pass
print(f'Recovered {recovered} contacts')

This script splits the file at each END:VCARD boundary, attempts to parse each block, and writes only the successfully parsed contacts. Contacts with structural damage are silently skipped. Run it, check how many contacts were recovered, and then manually inspect the skipped blocks for data worth salvaging.

Recovering Contacts from Severely Damaged Files

If a VCF file is too damaged for automated parsing (less than 50% of contacts recoverable), switch to a data extraction approach. Use grep to pull all recognizable contact data regardless of structure:

grep -E "^(FN|TEL|EMAIL|ORG|ADR)" damaged.vcf > extracted-fields.txt

This produces a list of all names, phone numbers, emails, organizations, and addresses found in the file, even from contacts with broken structure. You can then reconstruct contacts manually or import the extracted data into a spreadsheet. The fields will not be grouped by contact, so matching names to phone numbers requires manual review. This approach sacrifices structure for maximum data recovery.

How to Prevent VCF Corruption

Most VCF corruption is preventable with basic file handling practices. Always verify file integrity after transfer by comparing file sizes (source and destination should match exactly) and checking that the file ends with END:VCARD. Use UTF-8 encoding consistently, save files without BOM, and avoid opening VCF files in applications that might alter the encoding silently (like some versions of Excel). When exporting contacts, wait for the export process to complete fully before disconnecting devices or closing applications. Keep backup copies of important contact exports in a separate location from the working copy.

Frequently Asked Questions

Can a corrupted VCF file damage my contacts app?

No. A corrupted VCF file cannot harm your contacts application or existing contacts. The worst outcome is a failed import or partially imported data. If bad data is imported, you can delete the affected contacts manually. Your existing address book is never overwritten by an import operation.

How do I know if my VCF file is corrupted or just incompatible?

Incompatibility produces consistent errors across all contacts (every name garbled, every import failing the same way). Corruption produces random errors (some contacts work, others fail, garbled data appears in unpredictable locations). Open the file in a text editor and look for structural irregularities like missing END:VCARD tags, truncated data, or blocks of unreadable characters.

Can I recover a VCF file from a failed phone backup?

If the backup file exists but is damaged, use the grep extraction method from the recovery section to pull whatever readable data remains. If the file is partially readable, the Python repair script can recover intact contact blocks. For completely unreadable files (binary corruption throughout), recovery is unlikely without specialized data recovery tools.

My VCF file is 0 bytes. Can it be recovered?

A 0-byte file contains no data and cannot be repaired. The contact data was either never written or was completely overwritten. Check your recycle bin or trash for a previous version. If the file came from a cloud sync service, check the service’s version history for an earlier copy with actual data.

Should I repair the file or re-export from the original source?

If the original source is still available (phone, email client, cloud contacts), re-exporting is faster and more reliable than repairing a corrupted file. Repair is the right approach only when the corrupted file is the sole remaining copy of the contact data.

Conclusion

Last verified: February 2026. Repair methods tested with intentionally corrupted VCF files (truncated, null-injected, BOM-prepended, merged-contact, and encoding-damaged variants) across vCard 2.1, 3.0, and 4.0 formats. Python recovery script tested with vobject 0.9.7 on Python 3.12.

Most VCF corruption falls into one of eight categories, and each has a specific fix. Start by diagnosing the corruption type (count BEGIN/END markers, check file ending, search for null bytes, inspect the first bytes). Then apply the targeted repair: add missing tags, remove broken photos, strip null bytes, fix BOM, or correct encoding. For large-scale damage, use the Python recovery script to extract valid contacts and then manually salvage the rest.

Repair priority order: 1) Back up the corrupted file before any edits. 2) Count BEGIN:VCARD and END:VCARD – if they do not match, fix the tag structure first. 3) Remove null bytes and BOM. 4) Delete broken Base64 photo blocks. 5) Fix encoding if names are garbled. 6) Run the Python recovery script for any remaining issues. 7) Verify the repaired file in a VCF viewer before importing.

About the Author

This guide is written and maintained by the Univik team, developers of file conversion and digital forensics tools since 2013. We recover contact data from damaged and corrupted files as part of our forensic analysis work. The repair techniques in this guide are drawn from real data recovery cases. Need help with a corrupted VCF file you cannot fix yourself? Contact our support team.