vCard

How to Remove Images from VCF Files to Reduce File Size

Quick Answer

Open the VCF file in Notepad++ and use regex find-and-replace with the pattern PHOTO[^\r\n]*\r?\n(\s[^\r\n]*\r?\n)* (replace with empty). This removes all PHOTO properties including their Base64 continuation lines. For a 500-contact file with photos, this can reduce file size from 50 MB to under 1 MB. Always work on a copy of your file, not the original.

Introduction

A VCF file with 500 contacts and no photos is typically 200 to 500 KB. The same file with embedded contact photos can be 40 to 80 MB. Each photo adds 50 to 150 KB of Base64-encoded data per contact, and that adds up fast. When you need to email a VCF file, import it into a platform with size limits, or simply store it efficiently, removing the embedded photos is the most effective way to reduce file size.

This guide covers five methods for stripping photos from VCF files, from simple text editor editing to automated scripts that process thousands of contacts in seconds. Each method preserves all other contact data (names, phone numbers, emails, addresses, notes) while removing only the photo data.

Why Embedded Photos Make VCF Files So Large

Contact photos in VCF files are stored as Base64-encoded binary data directly inside the text file. Base64 encoding converts each 3 bytes of image data into 4 ASCII characters, which means every photo is roughly 33% larger in the VCF file than the original image. A 100 KB JPEG photo becomes approximately 133 KB of Base64 text, spread across dozens of folded lines.

The photo data appears as a PHOTO property followed by lines of seemingly random characters. In vCard 3.0, it looks like: PHOTO;ENCODING=b;TYPE=JPEG: followed by the Base64 string. These continuation lines start with a space character (line folding) and can span 50 to 200 lines per photo. In a file with 500 contacts, that is 25,000 to 100,000 lines of photo data that serve no purpose if you only need the text contact information.

For a deeper look at how VCF file size is affected by photos and other factors, see our VCF file size guide.

Before You Start: Back Up Your File

Every method in this guide modifies the VCF file by permanently deleting photo data. Before proceeding, copy the original file to a backup location. If you later need the photos, you can extract them from the backup. Name your working copy something distinct like contacts-nophotos.vcf so it is clear which version has photos and which does not.

Method 1: Text Editor (Manual)

Best for: Files with fewer than 20 contacts.

Open the VCF file in any text editor (Notepad++, VS Code, Sublime Text). Search for PHOTO to find each photo property. Select the entire PHOTO line and all continuation lines below it (lines starting with a space that contain Base64 data). Delete the selected block. Repeat for each contact. Save the file.

The challenge with manual deletion is identifying where the photo data ends. In vCard 3.0, the photo block ends when you reach a line that starts with a property name (like TEL, EMAIL, or END:VCARD) rather than a space. In vCard 2.1, a blank line terminates the photo block. Be careful not to delete the next property line. After saving, verify the file by checking that each contact still has its BEGIN:VCARD and END:VCARD markers and that no property lines were accidentally removed.

Method 2: Regex Find-and-Replace (Notepad++)

Best for: Files with 20 to 500 contacts. No coding required.

This is the fastest method for most users. Open the VCF file in Notepad++ and press Ctrl+H to open Find and Replace. Set the search mode to “Regular expression” and enter the following pattern:

Find: PHOTO[^\r\n]*\r?\n(\s[^\r\n]*\r?\n)*

Replace: leave empty

Click “Replace All”. This pattern matches the PHOTO property line and every subsequent continuation line (lines starting with whitespace). It handles both vCard 2.1 and 3.0 photo formats. For vCard 4.0 files where photos use URL references (PHOTO;MEDIATYPE=image/jpeg:https://...), the same pattern works because the URL appears on a single line with the PHOTO prefix.

After replacement, check the status bar in Notepad++ for the number of replacements made. If you had 500 contacts with photos, you should see approximately 500 replacements. Save the file with Ctrl+S.

Method 3: Command Line (sed/grep)

Best for: Mac/Linux users comfortable with terminal commands.

The sed command can remove PHOTO blocks in a single line. For vCard 3.0 files where photos use line folding (continuation lines starting with a space):

sed -i '/^PHOTO/,/^[^ ]/{/^PHOTO/d;/^ /d;}' contacts.vcf

This command finds lines starting with PHOTO, then deletes the PHOTO line and all subsequent lines starting with a space (the Base64 continuation lines), stopping when it encounters a line that does not start with a space (the next property). On macOS, use sed -i '' (with an empty string argument after -i) because BSD sed requires it.

For vCard 2.1 files where photo blocks end with a blank line instead of a non-space line, use: sed -i '/^PHOTO/,/^$/d' contacts.vcf. This deletes everything from the PHOTO line through the next blank line. Verify the result by checking: grep -c "PHOTO" contacts.vcf should return 0.

Method 4: Python Script

Best for: Large files (1,000+ contacts) or batch processing multiple files.

Python’s vobject library parses VCF files structurally and can remove specific properties cleanly without regex errors. The following script reads a VCF file, removes all PHOTO properties, and writes a clean output:

import vobject
with open('contacts.vcf', 'r') as f:
    text = f.read()
cards = vobject.readComponents(text)
with open('contacts-nophotos.vcf', 'w') as out:
    for card in cards:
        if hasattr(card, 'photo'):
            del card.contents['photo']
        out.write(card.serialize())

Install vobject first with pip install vobject. This method handles all vCard versions correctly, including edge cases like multiple PHOTO properties per contact and URL-referenced photos. It also preserves all other properties and formatting exactly as they were in the original file.

Method 5: Converter Software

Best for: Non-technical users who want a GUI-based approach.

Some VCF converter tools include options to exclude photos during conversion. The process is indirect: import the VCF file into the converter, select an output format (even VCF-to-VCF conversion), and deselect the photo field from the export options. The output file contains all contact data except photos.

Univik vCard Converter supports selective field export and contact preview, which lets you verify the output before saving. Google Contacts also works as an indirect method: import the VCF file into Google Contacts, then re-export as vCard. Google Contacts does not embed photos in exported VCF files (it uses URL references instead), so the re-exported file is significantly smaller.

Resize vs Remove: Keeping Smaller Photos

If you want to keep contact photos but reduce file size, resizing the photos before re-embedding is an alternative to removing them entirely. A 1024×1024 pixel contact photo at high quality occupies 100 to 200 KB in Base64. Resizing to 128×128 pixels and compressing to 60% JPEG quality reduces this to 3 to 8 KB per contact, cutting total photo data by 95%.

The process requires extracting photos from the VCF file, resizing them with an image tool (Python Pillow, ImageMagick, or any batch photo resizer), re-encoding as Base64, and replacing the original photo data in the VCF file. This is practical only with a script. A Python approach using Pillow:

from PIL import Image
import io, base64
img = Image.open(io.BytesIO(original_bytes))
img.thumbnail((128, 128))
buf = io.BytesIO()
img.save(buf, format='JPEG', quality=60)
small_b64 = base64.b64encode(buf.getvalue()).decode()

This hybrid approach works well for organizational directories where a thumbnail photo is useful but full-resolution images are unnecessary.

How to Verify Photos Were Removed

After removing photos, verify the result with these checks. First, compare file sizes: the stripped file should be 90 to 99% smaller than the original if most contacts had photos. Second, search the file for “PHOTO” using your text editor or grep -c "PHOTO" contacts-nophotos.vcf to confirm zero matches. Third, count contacts before and after to ensure none were accidentally deleted: grep -c "BEGIN:VCARD" contacts.vcf should return the same number for both files.

For a visual check, open the stripped file in a VCF viewer and verify that contacts display correctly with all fields intact except the photo. If any contact shows missing data other than photos, the removal process may have accidentally deleted adjacent property lines.

Frequently Asked Questions

Will removing photos affect any other contact data?

No, if done correctly. The PHOTO property is self-contained. Removing it does not affect names, phone numbers, emails, addresses, or any other property. The only risk is accidentally deleting lines adjacent to the photo block, which is why regex and script methods are safer than manual deletion for large files.

Can I remove photos from specific contacts only?

Yes. In a text editor, search for PHOTO and delete only the photo blocks belonging to specific contacts. With the Python script, add a condition to check the contact name before deleting the photo. The regex method removes all photos globally and cannot selectively target specific contacts without modification.

How much smaller will my file be after removing photos?

For a file where most contacts have embedded photos, expect a 90 to 99% size reduction. A 50 MB file with 500 photo-equipped contacts typically drops to 300 to 500 KB after photo removal. Contacts without photos contribute only 0.5 to 2 KB each to the file size.

Can I extract the photos before removing them?

Yes. Use a VCF converter tool to export contacts with photos to a format that saves photos separately (like HTML or a folder export). Alternatively, a Python script can decode the Base64 photo data and save each photo as a JPEG file named after the contact before deleting the PHOTO property from the VCF.

Does Google Contacts remove photos when exporting VCF?

Google Contacts exports photos as URL references (PHOTO;VALUE=uri:https://...) rather than embedded Base64 data. These URL references add only about 100 bytes per contact instead of 100+ KB. However, the photos are only accessible while the URL remains valid. If you need a truly photo-free file, remove the PHOTO lines from the Google export as well.

Conclusion

Last verified: February 2026. Regex patterns tested in Notepad++ 8.7 and VS Code 1.96. sed commands tested on macOS 15 and Ubuntu 24.04. Python script tested with vobject 0.9.7 and Python 3.12. File size measurements based on real-world VCF exports from iPhone 16, Samsung Galaxy S24, and Google Contacts.

Removing embedded photos is the single most effective way to reduce VCF file size. For small files, use Notepad++ regex (Method 2) for a quick one-click solution. For large files or batch processing, use the Python script (Method 4). For users who want a visual interface, converter software (Method 5) handles photo exclusion through field selection. In all cases, work on a copy, verify the contact count after removal, and confirm that no other data was lost.

Fastest method for most users: open in Notepad++, Ctrl+H, search mode “Regular expression”, find PHOTO[^\r\n]*\r?\n(\s[^\r\n]*\r?\n)*, replace with nothing, click “Replace All”. Save. Done. File size drops 90-99%. If you want to keep small thumbnails instead, use the Python resize approach to compress photos to 128×128 before re-embedding.

About the Author

This guide is written and maintained by the Univik team, developers of file conversion and digital forensics tools since 2013. We process VCF files with embedded photos daily and the regex patterns and scripts in this guide are taken from our production workflows. Need help with a VCF file that is too large to process? Contact our support team.