How to create your macro calculator in WordPress

How To Create Your Own Macro Calculator in WordPress

Looking for a straightforward way to create your own Macro calculator for a health & fitness business website?

You’ll be glad to hear that WPForms can help create calculator forms that automatically estimate daily calorie targets for various fitness goals.

Create Your Macronutrients Calculator Now

So, if you’re trying to provide your website visitors with a quick approach to estimate their IIFYM (If It Fits Your Macros), follow the steps in this guide!

How To Create a Macronutrients Calculator in WordPress

Creating a macronutrients calculator for your health & fitness website can bring a lot of traffic, as it can help visitors create a diet plan that best suits their needs.

Whether the goal is to help people lose weight, gain weight, or maintain their current weight, learning how many grams of fats, proteins, and carbohydrates make up most of their calories is incredibly helpful.

Luckily for you, adding your own macro calculator in WordPress is incredibly simple with WPForms. Follow the steps below to get started!

Step 1: Get the WPForms Pro License

WPForms is the best form builder plugin for WordPress that allows you to create all types of calculator forms. It comes with 2,000+ WordPress form templates for every industry, including health and fitness websites.

If you want to create a macro calculator by following the steps in this guide, you’ll require the WPForms Pro license, which also offers other premium features like conditional logic, form reports, advanced integrations, and more.

the wpforms homepage

Once you’ve purchased the Pro license, simply install and activate the WPForms plugin on your site. For more details, check out this step-by-step guide for instructions on how to install a plugin in WordPress.

Step 2: Activate the Calculations Addon

The next step is to install the Calculations Addon, which will allow you to create customizable formulas for counting macros, such as:

  • Proteins
  • Carbohydrates
  • Fats
  • Daily calorie intake

To get started with installing the addon, head to your WordPress dashboard, and from the sidebar, navigate to WPForms » Addons.

add new addon wpforms

From here, type “Calculations” into the Search Addons Field. Then, click on the Install Addon button, followed by the Activate button.

activate calculations addon

Great job! We’ll now show you how to create your macro calculator from scratch with the required formulas.

Step 3: Create Your Macro Calculator

It’s now time to build your macronutrients calculator. From your WordPress dashboard, go to WPForms and click on Add New.

add new form

In the next page, you will be required to give your form a name. Go ahead and type in whatever sounds good in the Name Your Form field.

name your calculator form

Great job! Now, scroll down a bit, and select Calculator » Fitness to view a list of suitable professionally-designed calculator templates.

select fitness calculator category

Here you’ll find several health and fitness-related calculators, including the ‘If It Fits Your Macros Calculator Template‘ which is relevant to our use-case.

Simply hover your mouse over the template and click on the Use Template button to proceed with customizing the form to your needs.

use macros calculator form template

Once you select your template, you’ll be redirected to the form builder screen. Here you can see currently available Fields on the left side of this screen.

WPForms fields menu

On the right side, you’ll see a preview of your form that you can customize. Since we’re using a template, the fields will be added automatically.

macros calculator form preview

You’re almost there! With the template, you should be good to do, but let’s also see how you can customize your Macros Calculator further.

Step 4: Customize the Macros Calculator Form

Most of the work is already done for you once the form template loads. You’ll find the following fields are already in the form:

  • Name for record-keeping purposes.
  • Email to send nutrition-related information.
  • Gender for calculations on physiological needs.
  • Age to determine metabolic rates that influence daily calorie intake.
  • System (Imperial/Metric) to decide on the preferred measuring system.
  • Height that can be entered in feet and inches or centimeters.
  • Weight that can be entered in pounds or kilograms.
  • Activity Level with choices like Sedentary, Light, Moderate, Very Active.
  • BMR Formula to calculate the amount of calorie intake (2 options).
  • Goal with choices such as Lose Weight, Maintain, or Gain Weight.
  • Calories Per Day that is auto-calculated based on user-selections.
  • Carbohydrates for assessing daily carbohydrate requirement.
  • Proteins to estimate the protein required for a balanced diet.
  • Fats to understand the fats required and complete the macro profile.

All fields come equipped with accurate formulas that help calculate the calories required per day through two different BMR methods:

  • Mifflin-St. Jeor — Estimates the daily calorie needs of an individual, factoring in their weight, height, age, and sex and adjusting it based on their Total Daily Energy Expenditure (TDEE).
  • Harris-Benedict Revised — Similar to the Mifflin-St. Jeor, this BMR also follows the same principle to calculate the macro ratio. The choice between the two depends on personal or professional preferences.

You can change the template in other ways to fit the needs of your business if you want to feel creative about how you use it.

For example, you can change the formulas or get rid of the “Submit” button. Here are the steps you need to take to make these changes.

Change the Formulas

From basic arithmetic operations to more complex formulas, the Calculations Addon can be used to create some amazing calculators.

Since we’re using a template, all the calculations will be added automatically, but you can change them or add your own using this cheatsheet!

You’ll need to add one of the supported fields that work with this to your form. We’ve marked the fields that work below:

  • Single Line Text
  • Paragraph Text
  • Number
  • Hidden
  • Single Item

To change the calculation, click on any supported field and navigate to the Field Options tab inside the form builder.

select field to change calculations

All you have to do now is click on the Advanced tab and change any calculations as they seem fit, under the Formula editor.

change calculation

If you want to ensure the syntax and formulas are correct, click on the Validate Formula link. If everything is fine, a green checkmark should show up.

validate formula

Remove Submit Button

You can also help users calculate their macronutrient intake with a stand-alone calculator, which doesn’t need a form submit action.

Just navigate to WPForms » Tools from your WordPress dashboard. Then, click on the Code Snippets tab.

code snippets tab

Now, type the name of the snippet you want to find (hide submit button) into the Search Snippets field and click the Install Snippet button.

Install hide submit button snippet

After that, simply paste the wpf-calc-form CSS into your form builder’s Submit Button CSS Class to make the code work.

add css class submit button

And that’s it! You can now publish the macros calculator on your website, which will help you drive more traffic and engagement.

Step 5: Publish Your Macronutrients Calculator

Once you’ve customized your macros calculator to include all your desired features, don’t forget to press the Save button.

Save the form

After that, click on the Embed button. You can now choose to publish your form to an existing page or create a new page.

Choose where you'd like to embed your form

If needed, you can also use the block editor to style your form further before publishing it on your WordPress website.

Once everything seems good to go, simply click on the Publish button at the top right corner of the page!

publish macronutrients calculator

You’ve now successfully created a macronutrients form, which you can use to attract more leads for those concerned about high protein and low carb diets, muscle gain and bodybuilding, and the list goes on!

FAQs about Macronutrient Calculators

Looking for answers to your questions? Check out some of the most frequently asked questions we receive about macro calculators!

How do I calculate my custom macros?

To figure out your personal macro needs, start by determining your daily calorie requirement. This is based on your activity level, goals (like fat loss or gaining weight), and basic body composition. Once you know your calorie target, divide these calories among carbs, proteins, and fats to create an appropriate dietary or meal plan.

What formulas do macro calculators use?

Macro calculators often use formulas like the Mifflin-St. Jeor Equation to estimate your basal metabolic rate (BMR), then adjust for your activity level to find your total daily energy expenditure (TDEE) to lose/build muscle, body fat, or body weight.

Your TDEE gives the number of calories needed to maintain your current weight. From there, calculators apply your goals (weight loss, weight gain, or maintain weight) and the desired macro split (40% carbs, 30% protein, 30% fats) for a flexible diet plan.

Can I customize a macro calculator?

You can create a tailored macro calculator using WPForms Pro and the Calculations Addon. This powerful combo lets you build a form where users input their details like weight, height, age, physical activity level, and goals.

The calculator then uses these inputs to compute and display personalized macro recommendations. It’s a fantastic tool for nutritionists, fitness coaches, or anyone looking to offer custom nutrition advice online.

Next, Learn How to Create a Price Calculator for Your Website

Looking for a solution that lets you create order forms with automatic price, shipping, and tax calculations? Check out this guide to learn how to create a price calculator for your website using WPForms!

Create Your WordPress Form Now

Ready to build your form? Get started today with the easiest WordPress form builder plugin. WPForms Pro includes lots of free templates and offers a 14-day money-back guarantee.

If this article helped you out, please follow us on Facebook and Twitter for more free WordPress tutorials and guides.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPForms is funded, why it matters, and how you can support us.

Hamza Shahid

Hamza is a Writer for the WPForms team, who also specializes in topics related to digital marketing, cybersecurity, WordPress plugins, and ERP systems. Learn More

The Best WordPress Drag and Drop Form Builder Plugin

Easy, Fast, and Secure. Join over 6 million website owners who trust WPForms.

Please enable JavaScript in your browser to complete this form.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.