7

I'm trying to find out how many bytes of data a PORTION of an email is taking up (not the whole email). How can I find this out?

Maybe there's something in a text editor like notepad++ that could tell me?

4
  • 1
    Notepad++ has a word count: paulhobson.com/wordpress/2009/06/notepad-word-count Feb 23, 2012 at 18:20
  • @IngmarHupp Thanks for the suggestion but how would that tell me the size of data?
    – Mike B
    Feb 23, 2012 at 19:03
  • Don't have a Windows machine at hand, but I figured it would give you the same line, word and character count as wc - does it not? Feb 23, 2012 at 21:01
  • Yup it does - wrote it up as a proper answer. Feb 24, 2012 at 13:45

5 Answers 5

4

Drag the message from your email client to the desktop and open the resulting file (probably .EML) in a text editor that supports different encodings and shows the size of the data (eg Notepad2). Then you can simply cut the message before and after to see the actual size of the desired block (in the status bar for Notepad2).

7

Notepad++ does this. Simply copy & paste the part of the message you want to size up into a new tab and read the length off the length field in the status bar at the bottom:

If you set the encoding to match your email client (Encoding menu -> UTF-8), it will count Unicode characters correctly (for example, ☃ is 3 bytes long in UTF-8 encoding).

This will only apply to plain-text emails, not to HTML or multipart/alternative emails.

enter image description here

0
3

Each character in the plain text should be equal to 1 byte. So 512 characters would be 0.5KB; 1024 characters would be 1KB and so forth. For example, this sample e-mail would be 308 bytes:

Date: Thu Feb 23 2012 12:00:00 -0800
From: Bob <[email protected]>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: [email protected]
Subject: Test
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

This is a test message

Edit: To clarify, "one character" refers to the raw source of the e-mail message, not the formatted representation shown by most e-mail clients. The original question refers specifically to plain text and to Notepad++ (which has ANSI as its default encoding) so I assumed that the message would be encoded as plain ANSI.

12
  • 3
    -1 for "each character = 1 byte". Not true since long ago. Feb 23, 2012 at 19:23
  • @grawity, e-mail is encoded in 7 bit ASCII and always has been. Since a byte (8 bits) is the smallest individual datum that can be directly manipulated, each 7 bit character is stored as 1 byte. Open the raw data of any e-mail in a hex editor and you will see that each character uses 1 byte. Feb 24, 2012 at 0:32
  • 2
    does not take up one byte. Feb 24, 2012 at 0:43
  • 1
    @MikeB Spaces and white space consist of characters.
    – iglvzx
    Feb 24, 2012 at 2:21
  • 1
    @iglvzx Thanks. Didn't know that.
    – Mike B
    Feb 24, 2012 at 2:26
2

To get a good estimate, one thing you can do is copy and paste the text to a .txt file and then read the resulting file size. I've written an AutoHotkey script to make it a little easier. Press Win+C to have a little popup message display the file size of the selected text.

#c:: ;[Win]+[C]
{
    OriginalClipboard := Clipboard
    Clipboard =
    Send, ^c
    ClipWait
    FileAppend, %Clipboard%, temp.txt
    Clipboard =
    Clipboard := OriginalClipboard
    ClipWait
    FileGetSize, fileSize, temp.txt
    MsgBox, , , Bytes: %fileSize%
    FileDelete, temp.txt
    return
}

Meta: my answer above is about 600 bytes.

1

If you are sending your email as plain text then the number of bytes will be roughly equal to the number of characters in the selected text. If you paste the text into Microsoft Word it will be able to do a letter count for you to help.

If you are sending your email as Rich Text or HTML then there is no easy formula. In general the longer and the more complicated the formatting of the text is, the larger it will be in bytes.

If it really matters that you reduce the size of your email, always use plain text encoding.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .