Title: Binary to Decimal value
Last modified: February 11, 2024

---

# Binary to Decimal value

 *  Resolved [lowercas3](https://wordpress.org/support/users/lowercas3/)
 * (@lowercas3)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/binary-to-decimal-value/)
 * Hello, what is the function to convert a binary entry (assume a field entry consisting
   of a string of 0’s and 1’s) to it’s decimal equivalent?
 * Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/binary-to-decimal-value/#post-17416383)
 * Hello [@lowercas3](https://wordpress.org/support/users/lowercas3/)
 * Thank you very much for using our plugin. Assuming the field’s name is fieldname1,
   the equation in the calculated field would be:
 *     ```wp-block-code
       parseInt(fieldname1|r, 2);
       ```
   
 * The |r modifier allows you to access the field’s raw values instead of the preprocessing
   one. The plugin preprocesses the fields’ values to use them in mathematical operations.
 * Best regards.
 *  Thread Starter [lowercas3](https://wordpress.org/support/users/lowercas3/)
 * (@lowercas3)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/binary-to-decimal-value/#post-17419585)
 * Thank you for your response. This works except when there’s a zero as the first
   digit. 101 works for instance but 0101 does not.
 * Any thoughts on how to resolve this?
 * Best wishes
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/binary-to-decimal-value/#post-17419608)
 * Hello [@lowercas3](https://wordpress.org/support/users/lowercas3/)
 * Could you please indicate the control type that contains the number in binary
   format?
 * You must use a “Single Line” text field and refer to it from the equation with
   the |r modifier.
 * Could you please provide the link to the page that contains the form to check
   your equation in action?
 * Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Binary to Decimal value’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/binary-to-decimal-value/#post-17419608)
 * Status: resolved