Skip to content

PCAP vs. PCAPNG: What Changes When You Convert a Capture?

Convert a two-packet PCAPNG file to PCAP. Use Wireshark tools to check which comments disappear and whether the packet payloads still match.

By Sourabh8 min read

You export a PCAPNG file as PCAP for a tool that expects the older format. Both captures open in Wireshark and show the same number of packets. Did the conversion keep everything you need? It can keep the packets and still drop the notes and capture context that help explain them.

In this walkthrough, you’ll build a two-packet training capture, attach one note to the file and one to its first packet, then compare it with a classic PCAP copy. The packets are generated locally for the exercise. You never have to capture live traffic. You’ll finish with a short note that tells another reader what survived, what changed, and which file to keep.

Check What Each Format Can Store

Both formats hold packet records, which include the bytes recorded from the network and information such as packet timestamps. Classic PCAP is useful when a tool expects that format. PCAPNG can also carry capture-wide comments, notes attached to individual packets, and details about the capture interfaces. An interface is the point where the packets were recorded. The PCAP and PCAPNG glossary gives you the format basics.

Support for a feature means a file can hold information. What it actually holds depends on which capture or export tool wrote it. For example, a PCAPNG file can be perfectly valid without a single comment. Check what your file contains before deciding which fields a conversion needs to preserve.

Think about the question you need to answer. If you only need to read the two messages in this exercise, their bytes are the main thing to check. If you need to explain where a packet was seen or why somebody flagged it, the interface details or a packet comment may matter just as much. It helps to write that question down before you export anything.

Build a Capture With Two Different Kinds of Notes

Use the command-line tools from Wireshark. In a new practice folder, make a plain-text file named packets.hex containing the two lines below, with a blank line between them:

text
0000 4c 41 42 20 4f 4e 45

0000 4c 41 42 20 54 57 4f

Each line starts at byte offset zero and represents a different packet payload. The bytes spell LAB ONE and LAB TWO. If you use TextEdit on a Mac, choose Make Plain Text before saving. A rich-text file may still look right on screen, but the extra formatting gets in the way when text2pcap reads it. text2pcap wraps them in synthetic UDP packets, so you can repeat the test without a network connection. Run these as separate commands on macOS, Linux, or Windows with the tools available on your command path:

bash
text2pcap -F pcapng -u 41000,41001 packets.hex raw-lab.pcapng
editcap --discard-capture-comment --capture-comment "Practice capture" -a "1:Check this packet" raw-lab.pcapng original.pcapng

The first comment describes the capture as a whole. The discard flag drops the automatically generated capture comment so the exercise starts with just the note you add. The 1: in the second command attaches the other comment to the first packet. Treat original.pcapng as the original from this point in the exercise.

On macOS, the tools can also be run directly from the Wireshark app bundle if you haven’t installed the command-line shortcuts. On Windows, use the executables from the Wireshark installation folder if the commands aren’t on your path. The Wireshark guide covers opening and inspecting captures in the desktop app.

Check the File Content Before Using Its Extension

Run:

bash
capinfos -t -c -k original.pcapng

The -t flag shows the detected file type, -c shows the packet count, and -k prints the capture comment when one is present. Packet comments are separate, so check them with TShark:

bash
tshark -r original.pcapng -T fields -E separator=, -e frame.number -e frame.comment

Packet 1 has the note you added. Packet 2 has an empty comment field. If you get just two packet numbers with no notes, repeat the annotation step and make sure you opened original.pcapng rather than raw-lab.pcapng.

Renaming a file changes the label on the outside. To try that safely, duplicate the original and name the duplicate renamed.pcap. Run capinfos -t renamed.pcap. It still identifies the duplicate as PCAPNG because the bytes inside the file haven’t changed. This is the same principle behind identifying a file from its magic bytes.

Capinfos detects PCAPNG in both files. The filename extension changed, while the file contents stayed the same.

Convert to PCAP and Run the Same Checks

Write the result to a new file:

bash
editcap -F pcap original.pcapng converted.pcap
capinfos -t -c -k original.pcapng converted.pcap
tshark -r converted.pcap -T fields -E separator=, -e frame.number -e frame.comment

Here’s what the checks showed in the lab with Wireshark 4.6.10 on macOS:

Scroll horizontally if needed to see the full table.

Field checkedoriginal.pcapngconverted.pcap
Detected formatPCAPNGClassic PCAP
Packet count22
Capture commentPractice captureAbsent
Packet 1 commentCheck this packetAbsent

Both files still have two packets. The capture-wide comment and the note on packet 1 are gone from the PCAP copy. A packet count is a useful first check, but it gives you no information about those notes or whether the packet bytes are identical.

In the PCAPNG, the text after the first comma is the packet comment. The converted PCAP still lists both packet numbers, but the comment field is empty.

Read the comma in the image as a separator. Everything before it is the packet number. Everything after it is the comment. The original has text after 1,. The converted file still has a row for packet 1, and the space after its comma is empty. That is how you can tell the comment is missing without mistaking it for a missing packet.

To check the payloads too, run the following once for each filename:

bash
tshark -r original.pcapng -T fields -e frame.number -e udp.payload
tshark -r converted.pcap -T fields -e frame.number -e udp.payload

In both outputs, packet 1 contains 4c4142204f4e45 and packet 2 contains 4c41422054574f. That checks the payload field for these two packets. A comparison of an actual evidence capture may also need to check packet lengths, encapsulation, timestamps and their precision, and which interface recorded each frame. Some captures with multiple link-layer types may fail to convert to classic PCAP in a single file. Keep the original available so you can check the properties you rely on.

Check More Than the Packet Count

Try capinfos -E -I original.pcapng converted.pcap. The two files use Ethernet. In the original, interface 0 has a name, Fake IF, text2pcap. The PCAP copy still reports the Ethernet link type, but that interface name is gone. An interface name can tell you which observation point a packet belongs to when a capture includes more than one.

There is another difference in this run. The PCAPNG shows nanosecond timestamp precision and the classic PCAP shows microsecond precision. The two timestamps happened to fall on whole microseconds, so the values we read back were the same. You can check both files with tshark -r FILE -T fields -e frame.number -e frame.time_epoch, replacing FILE with one filename at a time. Precision tells you how finely a format can represent time. It does not tell you how accurate the capture clock was. If timing matters, verify the exported values with your own file.

If the Conversion Fails or the Numbers Differ

Check the filename, the destination folder, and the message that Editcap printed. Make sure you can open the source. If Editcap says the output format cannot hold the capture's link types, keep working from the PCAPNG or export a clearly labeled subset if that serves the task. If the packet counts differ, check whether you saved only displayed or selected packets. Open the export on its own and check it before passing it on.

Preserve the Original and Record the Conversion

If you need PCAP to let another tool read the capture, keep the PCAPNG as received and use the converted PCAP as a working file. Record the input and output filenames, tool and version, format change, and the fields you verified. Hash the two files separately if they are being handed off. The two full-file hashes will differ for this conversion even though the packet payloads agree. The format rewrite changes the bytes that hold the packets and metadata. For the renamed copy, a hash comparison should match the original because renaming changed only the filename.

On macOS, run shasum -a 256 original.pcapng renamed.pcap converted.pcap to see both results beside each other.

The lab compared the full SHA-256 values. The renamed copy matches the original. Conversion rewrites the file, so the working PCAP has a different digest.

A short note for this exercise could read: “Converted original.pcapng to classic PCAP for compatibility. Both files contain two packets with the same UDP payloads in order. The capture comment and packet 1 comment are present only in the PCAPNG.” The packet capture and evidence collection lesson puts that note in the context of the full collection and handoff. The NetworkMiner practice lab shows how to use a capture to verify what crossed the network.

Before you rely on your next converted capture, choose one field your finding depends on and check it in both files. That is the comparison a second examiner needs to be able to repeat.

Was this page helpful?