Few people asked me how I count, how much is any arbitrary text “worth” in kilobytes, how I calculate that in my web apps. The answer is simple.
One character in a file “weighs” one byte.
While a kilo-meter is a thousand metres, a kilo-byte is 1024 bytes.
From there, one megabyte equals 1024 kilobytes and so on.
Funny, there’s no mega-meter, but we have a nano-meter.
Back on the subject, here’s a proof — create an HTML file with six characters, then check the file’s size:
That’s how I convert the string length into file size in GUI apps, like here: