The Blob.size property returns the size in bytes of the Blob or a File.


var sizeInBytes = blob.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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support5 Yes410115.1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No No Yes No No No ?

See also

Document Tags and Contributors

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