---
title: "How do you convert numbers between different bases in JavaScript?"  
description: "How do you convert numbers between different bases in JavaScript?"  
author: "AVADHESH PATEL"  
published: 2012-08-01  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/1498/how-do-you-convert-numbers-between-different-bases-in-javascript  
category: "javascript"  
tags: ["jquery", "javascript", "convert number", "mindstick", "interview question", "interview"]  
reading_time: 1 minute  

---

# How do you convert numbers between different bases in JavaScript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);

## Answers

### Answer by AVADHESH PATEL

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);


---

Original Source: https://www.mindstick.com/interview/1498/how-do-you-convert-numbers-between-different-bases-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
