JS Example for Beginners: Javascript Program to Convert Celsius to Fahrenheit

(JavaScript programming Example for Beginners)

Javascript Program to Convert Celsius to Fahrenheit

In this example, you will learn to convert Celsius value to Fahrenheit in JavaScript.


You can convert the celsius value to fahrenheit by using the formula:

fahrenheit = celsius * 1.8 + 32

Example: Celsius to Fahrenheit

// program to convert celsius to fahrenheit
// ask the celsius value to the user 
let celsius = prompt("Enter a celsius value: ");

// calculate fahrenheit
let fahrenheit = (celsius * 1.8) + 32

// display the result
console.log(`${celsius} degree celsius is equal to ${fahrenheit} degree fahrenheit.`);


Enter a celsius value: 55
55 degree celsius is equal to 131 degree fahrenheit.

In the above program, the user enters the celsius value and is stored in the celsius variable. Then the fahrenheit formula is used to convert celsius value to fahrenheit.

You can convert fahrenheit value to celsius using the formula:

celsius = (fahrenheit - 32) / 1.8



JS Example for Beginners: Javascript Program to Convert Celsius to Fahrenheit

Sign up to get end-to-end “Learn By Coding” example.

Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.