The Blob.size property returns the size of the file in bytes.


var filesize = instanceOfFile.size


A number.


// fileInput is a HTMLInputElement: <input type="file" multiple id="myfileinput">
var fileInput = document.getElementById("myfileinput");

// files is a FileList object (simliar to NodeList)
var files = fileInput.files;

for (var i = 0; i < files.length; i++) {
  console.log(files[i].name + " has a size of " + files[i].size + " Bytes");


Specification Status Comment
File API
The definition of 'size' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit) 5 4.0 (2) 10.0 11.10 5.1
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Not supported Not supported Not supported Not supported Not supported

See also

Document Tags and Contributors

Contributors to this page: Sheppy, fscholz, Jeremie, Crash, ziyunfei, ethertank, Cobra
Last updated by: fscholz,