Title: number_format_i18n
Published: April 25, 2014
Last modified: May 20, 2026

---

# number_format_i18n( float $number, int $decimals ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#wp--skip-link--target)

Converts float number to format based on the locale.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#parameters)󠁿

 `$number`floatrequired

The number to convert based on locale.

`$decimals`intoptional

Precision of the number of decimal places. Default 0.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#return)󠁿

 string Converted number in string format.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#more-information)󠁿

**i18n** is an abbreviation for internationalization.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#source)󠁿

    ```php
    function number_format_i18n( $number, $decimals = 0 ) {
    	global $wp_locale;

    	if ( isset( $wp_locale ) ) {
    		$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
    	} else {
    		$formatted = number_format( $number, absint( $decimals ) );
    	}

    	/**
    	 * Filters the number formatted based on the locale.
    	 *
    	 * @since 2.8.0
    	 * @since 4.9.0 The `$number` and `$decimals` parameters were added.
    	 *
    	 * @param string $formatted Converted number in string format.
    	 * @param float  $number    The number to convert based on locale.
    	 * @param int    $decimals  Precision of the number of decimal places.
    	 */
    	return apply_filters( 'number_format_i18n', $formatted, $number, $decimals );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/functions.php#L424)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/functions.php#L424-L444)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#hooks)󠁿

 [apply_filters( ‘number_format_i18n’, string $formatted, float $number, int $decimals )](https://developer.wordpress.org/reference/hooks/number_format_i18n/)

Filters the number formatted based on the locale.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#related)󠁿

| Uses | Description | 
| [absint()](https://developer.wordpress.org/reference/functions/absint/)`wp-includes/load.php` |

Converts a value to non-negative integer.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_Debug_Data::get_wp_server()](https://developer.wordpress.org/reference/classes/wp_debug_data/get_wp_server/)`wp-admin/includes/class-wp-debug-data.php` |

Gets the WordPress server section of the debug data.

  | 
| [WP_Site_Health::get_test_page_cache()](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_page_cache/)`wp-admin/includes/class-wp-site-health.php` |

Tests if a full page cache is available.

  | 
| [rest_validate_object_value_from_schema()](https://developer.wordpress.org/reference/functions/rest_validate_object_value_from_schema/)`wp-includes/rest-api.php` |

Validates an object value based on a schema.

  | 
| [rest_validate_array_value_from_schema()](https://developer.wordpress.org/reference/functions/rest_validate_array_value_from_schema/)`wp-includes/rest-api.php` |

Validates an array value based on a schema.

  | 
| [rest_validate_string_value_from_schema()](https://developer.wordpress.org/reference/functions/rest_validate_string_value_from_schema/)`wp-includes/rest-api.php` |

Validates a string value based on a schema.

  | 
| [WP_MS_Sites_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/)`wp-admin/includes/class-wp-ms-sites-list-table.php` |

Gets links to filter sites by status.

  | 
| [WP_Privacy_Requests_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_privacy_requests_table/get_views/)`wp-admin/includes/class-wp-privacy-requests-table.php` |

Gets an associative array ( id => link ) with the list of views available on this table.

  | 
| [WP_Customize_Manager::handle_load_themes_request()](https://developer.wordpress.org/reference/classes/wp_customize_manager/handle_load_themes_request/)`wp-includes/class-wp-customize-manager.php` |

Loads themes into the theme browsing/installation UI.

  | 
| [WP_Widget_Media::display_media_state()](https://developer.wordpress.org/reference/classes/wp_widget_media/display_media_state/)`wp-includes/widgets/class-wp-widget-media.php` |

Filters the default media display states for items in the Media list table.

  | 
| [WP_Customize_Manager::save_changeset_post()](https://developer.wordpress.org/reference/classes/wp_customize_manager/save_changeset_post/)`wp-includes/class-wp-customize-manager.php` |

Saves the post for the loaded changeset.

  | 
| [print_embed_comments_button()](https://developer.wordpress.org/reference/functions/print_embed_comments_button/)`wp-includes/embed.php` |

Prints the necessary markup for the embed comments button.

  | 
| [WP_Customize_Nav_Menus::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/enqueue_scripts/)`wp-includes/class-wp-customize-nav-menus.php` |

Enqueues scripts and styles for Customizer pane.

  | 
| [WP_Customize_Nav_Menus::customize_register()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/customize_register/)`wp-includes/class-wp-customize-nav-menus.php` |

Adds the customizer settings and controls.

  | 
| [WP_MS_Sites_List_Table::column_users()](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/column_users/)`wp-admin/includes/class-wp-ms-sites-list-table.php` |

Handles the users column output.

  | 
| [get_comments_number_text()](https://developer.wordpress.org/reference/functions/get_comments_number_text/)`wp-includes/comment-template.php` |

Displays the language string for the number of comments the current post has.

  | 
| [WP_MS_Users_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_ms_users_list_table/get_views/)`wp-admin/includes/class-wp-ms-users-list-table.php` |  | 
| [WP_Screen::render_screen_layout()](https://developer.wordpress.org/reference/classes/wp_screen/render_screen_layout/)`wp-admin/includes/class-wp-screen.php` |

Renders the option for number of columns on the page.

  | 
| [WP_Plugins_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_plugins_list_table/get_views/)`wp-admin/includes/class-wp-plugins-list-table.php` |  | 
| [WP_User_Search::do_paging()](https://developer.wordpress.org/reference/classes/wp_user_search/do_paging/)`wp-admin/includes/deprecated.php` |

Handles paging for the user search query.

  | 
| [WP_List_Table::ajax_response()](https://developer.wordpress.org/reference/classes/wp_list_table/ajax_response/)`wp-admin/includes/class-wp-list-table.php` |

Handles an incoming ajax request (called from admin-ajax.php)

  | 
| [WP_List_Table::comments_bubble()](https://developer.wordpress.org/reference/classes/wp_list_table/comments_bubble/)`wp-admin/includes/class-wp-list-table.php` |

Displays a comment count bubble.

  | 
| [WP_List_Table::pagination()](https://developer.wordpress.org/reference/classes/wp_list_table/pagination/)`wp-admin/includes/class-wp-list-table.php` |

Displays the pagination.

  | 
| [WP_MS_Themes_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_ms_themes_list_table/get_views/)`wp-admin/includes/class-wp-ms-themes-list-table.php` |

Gets the list of views (statuses) for the list table.

  | 
| [install_plugin_information()](https://developer.wordpress.org/reference/functions/install_plugin_information/)`wp-admin/includes/plugin-install.php` |

Displays plugin information in dialog box form.

  | 
| [wp_dashboard_quota()](https://developer.wordpress.org/reference/functions/wp_dashboard_quota/)`wp-admin/includes/dashboard.php` |

Displays file upload quota on dashboard.

  | 
| [wp_dashboard_right_now()](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/)`wp-admin/includes/dashboard.php` |

Dashboard widget that displays some basic stats about the site.

  | 
| [wp_network_dashboard_right_now()](https://developer.wordpress.org/reference/functions/wp_network_dashboard_right_now/)`wp-admin/includes/dashboard.php` |  | 
| [WP_Plugin_Install_List_Table::display_rows()](https://developer.wordpress.org/reference/classes/wp_plugin_install_list_table/display_rows/)`wp-admin/includes/class-wp-plugin-install-list-table.php` |

Generates the list table rows.

  | 
| [wp_star_rating()](https://developer.wordpress.org/reference/functions/wp_star_rating/)`wp-admin/includes/template.php` |

Outputs a HTML element with a star rating for a given rating.

  | 
| [WP_Users_List_Table::single_row()](https://developer.wordpress.org/reference/classes/wp_users_list_table/single_row/)`wp-admin/includes/class-wp-users-list-table.php` |

Generates HTML for a single row on the users.php admin panel.

  | 
| [WP_Users_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_users_list_table/get_views/)`wp-admin/includes/class-wp-users-list-table.php` |

Returns an associative array listing all the views that can be used with this table.

  | 
| [media_upload_library_form()](https://developer.wordpress.org/reference/functions/media_upload_library_form/)`wp-admin/includes/media.php` |

Outputs the legacy media upload form for the media library.

  | 
| [media_handle_upload()](https://developer.wordpress.org/reference/functions/media_handle_upload/)`wp-admin/includes/media.php` |

Saves a file submitted from a POST request and create an attachment post for it.

  | 
| [wp_ajax_query_themes()](https://developer.wordpress.org/reference/functions/wp_ajax_query_themes/)`wp-admin/includes/ajax-actions.php` |

Handles getting themes from [themes_api()](https://developer.wordpress.org/reference/functions/themes_api/) via AJAX.

  | 
| [_wp_ajax_delete_comment_response()](https://developer.wordpress.org/reference/functions/_wp_ajax_delete_comment_response/)`wp-admin/includes/ajax-actions.php` |

Sends back current comment total and new page links if they need to be updated.

  | 
| [wp_ajax_replyto_comment()](https://developer.wordpress.org/reference/functions/wp_ajax_replyto_comment/)`wp-admin/includes/ajax-actions.php` |

Handles replying to a comment via AJAX.

  | 
| [post_submit_meta_box()](https://developer.wordpress.org/reference/functions/post_submit_meta_box/)`wp-admin/includes/meta-boxes.php` |

Displays post submit form fields.

  | 
| [WP_Comments_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_views/)`wp-admin/includes/class-wp-comments-list-table.php` |

Returns an array of comment status links.

  | 
| [WP_Terms_List_Table::column_posts()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/column_posts/)`wp-admin/includes/class-wp-terms-list-table.php` |  | 
| [WP_Terms_List_Table::column_links()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/column_links/)`wp-admin/includes/class-wp-terms-list-table.php` |  | 
| [WP_Posts_List_Table::get_views()](https://developer.wordpress.org/reference/classes/wp_posts_list_table/get_views/)`wp-admin/includes/class-wp-posts-list-table.php` |  | 
| [list_plugin_updates()](https://developer.wordpress.org/reference/functions/list_plugin_updates/)`wp-admin/update-core.php` |

Display the upgrade plugins form.

  | 
| [list_theme_updates()](https://developer.wordpress.org/reference/functions/list_theme_updates/)`wp-admin/update-core.php` |

Display the upgrade themes form.

  | 
| [Walker_CategoryDropdown::start_el()](https://developer.wordpress.org/reference/classes/walker_categorydropdown/start_el/)`wp-includes/class-walker-category-dropdown.php` |

Starts the element output.

  | 
| [Walker_Category::start_el()](https://developer.wordpress.org/reference/classes/walker_category/start_el/)`wp-includes/class-walker-category.php` |

Starts the element output.

  | 
| [wp_generate_tag_cloud()](https://developer.wordpress.org/reference/functions/wp_generate_tag_cloud/)`wp-includes/category-template.php` |

Generates a tag cloud (heatmap) from provided data.

  | 
| [wp_notify_moderator()](https://developer.wordpress.org/reference/functions/wp_notify_moderator/)`wp-includes/pluggable.php` |

Notifies the moderator of the site about a new comment that is awaiting approval.

  | 
| [paginate_links()](https://developer.wordpress.org/reference/functions/paginate_links/)`wp-includes/general-template.php` |

Retrieves paginated links for archive post pages.

  | 
| [timer_stop()](https://developer.wordpress.org/reference/functions/timer_stop/)`wp-includes/load.php` |

Retrieves or displays the time from the page start to when function is called.

  | 
| [size_format()](https://developer.wordpress.org/reference/functions/size_format/)`wp-includes/functions.php` |

Converts a number of bytes to the largest unit the bytes will fit into.

  | 
| [wp_admin_bar_comments_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_comments_menu/)`wp-includes/admin-bar.php` |

Adds edit comments link with awaiting moderation count bubble.

  | 
| [wp_admin_bar_updates_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_updates_menu/)`wp-includes/admin-bar.php` |

Provides an update link if theme/plugin/core updates are available.

  | 
| [wpmu_validate_blog_signup()](https://developer.wordpress.org/reference/functions/wpmu_validate_blog_signup/)`wp-includes/ms-functions.php` |

Processes new site registrations.

  | 
| [comments_popup_link()](https://developer.wordpress.org/reference/functions/comments_popup_link/)`wp-includes/comment-template.php` |

Displays the link to the comments for the current post ID.

  | 
| [WP_Customize_Widgets::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_customize_widgets/enqueue_scripts/)`wp-includes/class-wp-customize-widgets.php` |

Enqueues scripts and styles for Customizer panel and export data to JavaScript.

  |

[Show 50 more](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#comment-content-1331)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/number_format_i18n/#comment-1331)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%23comment-1331)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%23comment-1331)
 4.  **Basic Example**
 5.      ```php
         $number = 3948;
     
         $formatted = number_format_i18n( $number );
         ```
     
 6.  $formatted will now be something like “3,948”.
 7.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%3Freplytocom%3D1331%23feedback-editor-1331)
 8.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/number_format_i18n/?output_format=md#comment-content-1332)
 9.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/number_format_i18n/#comment-1332)
 10. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%23comment-1332)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%23comment-1332)
 11. **Using the $decimal Parameter**
 12.     ```php
         $number = 3948;
     
         $formatted = number_format_i18n( $number, 2 );
         ```
     
 13. $formatted will now be something like “3,948.00”.
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F%3Freplytocom%3D1332%23feedback-editor-1332)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fnumber_format_i18n%2F)
before being able to contribute a note or feedback.