WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by ikaring v1.3.0

Get Filesize Shortcode

"Get Filesize Shortcode" is a simple shortcode to get filesize of a file( eg. PDF, JPG, PNG ... ).

Get Filesize Shortcode

The facts

Rating
5★ from 3
Active installs
200+
Price
Free
Last updated
15 Jul 2025
Added
Jan 2015
Requires WP
5.8
Tested up to
WP 6.8.8
Requires PHP
5.6
Downloads
4,918

Our analysis

AI-assisted

Get Filesize Shortcode is a WordPress plugin that allows you to display the filesize of various file types, such as PDFs and images, in a human-readable format. You can use a shortcode in your posts or a block in the editor to generate a link to the file along with its size. This plugin is useful for users who want to provide file size information to their visitors directly on their WordPress site.

To use the plugin, simply insert the shortcode with the file URL or use the provided block to set the file title and URL. The plugin retrieves the size of the file stored on your server, but be aware that files larger than 2MB may yield inconsistent size readings due to PHP specifications.

Best for: This plugin is suitable for WordPress users who need to display file sizes for downloadable content on their site.

What it does well

  • Displays file sizes in a human-readable format
  • Supports various file types like PDF, JPG, and PNG
  • Can be used as a shortcode or a block in the editor
  • Easy to implement with a simple shortcode syntax
  • Free to use from the WordPress.org directory

Where it falls short

  • File must be hosted on your server
  • May return inconsistent sizes for files larger than 2MB

Verdict

Get Filesize Shortcode provides a straightforward solution for displaying file sizes, but be mindful of its limitations with larger files.

From the developer

ikaring's own description of Get Filesize Shortcode, lightly tidied.

“Get Filesize Shortcode” is a simple shortcode to get filesize of a file( eg. PDF, JPG, PNG … ) with a human readable format, using the largest unit the bytes will fit into.
Now added Get filesize block to display file link with file size.

Usage

Put [filesize]http://yoursite.com/path/to/file.pdf[/filesize] anywhere in a post.

Or you can use url attr instead. [filesize url='http://yoursite.com/path/to/file.pdf']

Also you can place <?php echo do_shortcode('[filesize]http://yoursite.com/path/to/file.pdf[/filesize]'); ?> in your templates.

As to “Get filesize” block, search ‘get filesize’ in Text block category and insert it.
Set file title and file url, and it generates a text link to the file with file size afterwards.
You can toggle Preview/Edit by clicking Preview/Edit button in toolbar of the block.

Note

  • File must be in your server
  • With files larger than 2MB, it might return different number due to the spec of filesize function of PHP.

Read the full description on the official page →

Tagged as