Some people have been linking to off-site resources for counting the length of an answer (mostly https://mothereff.in/byte-counter). Some people also pointed out that it only counts in UTF-8.
Well, I was bored so I created a snippet. It counts in UTF-8 if you paste in code, and counts in pure binary bytes if you either drop and drag a file, or select a file from a dialog. Raw non-minified source is here and a full page version can be found here.
It requires a modern browser supporting the HTML5 File API.
Byte counter
<!DOCTYPE html><html><head><style type=text/css>html,body{margin:0;height:100%;overflow-y:hidden;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif}#wrapper{overflow-y:hidden;margin:0;min-height:100%;padding:10px}#fileinput{display:none}#bytes,#chars{white-space:nowrap;font-weight:bold;font-size:20px;padding-right:10px}td{vertical-align:middle}table{margin-bottom:10px;margin-right:80px}#textinput{width:100%;box-sizing:border-box}</style><!--[if lte IE 6]><style type=text/css>#container{height:100%}</style><![endif]--></head><body><div id=wrapper><table><tr><td id=bytes>0 bytes</td><td rowspan=2>Drag and drop a file anywhere on this snippet, <a href=# id=fileselect>select a file using a dialog</a>, or enter UTF-8 code in the textbox.</td></tr><tr><td id=chars>0 chars</td></tr></table><input type=file id=fileinput onchange=handle_file(this.files)><textarea id=textinput onkeyup=textbox(this.value) onchange=textbox(this.value)></textarea></div><script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script><script type=text/javascript>function nodefault(a){a.stopPropagation();a.preventDefault()}function handle_file(b){var a=new FileReader();a.onload=function(c){$("#chars").text(a.result.length+" chars")};a.readAsText(b[0],"UTF-8");$("#bytes").text(b[0].size+" bytes")}function textbox(a){$("#bytes").text((new Blob([a],{encoding:"UTF-8",type:"text/plain;charset=UTF-8"})).size+" bytes");$("#chars").text(a.length+" chars")}function drop(a){nodefault(a);handle_file(a.dataTransfer.files)}function click(a){nodefault(a);$("#fileinput")[0].click()}$(document).ready(function(){var a=function(){$("#textinput").height($(window).height()-$("#textinput").offset().top-20)};$(window).resize(a);a()});document.body.addEventListener("dragenter",nodefault,false);document.body.addEventListener("dragover",nodefault,false);document.body.addEventListener("drop",drop,false);$("#fileselect").on("click",click);</script></body></html>