Math.DecToHex
-------------

Converts a number to a hexadecimal number.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Math](component_Math.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Math.DecToHex"; Number { ; NoLeadingZeros } ) 

**MBS**( **"Math.DecToHex";** /\* Converts a number to a hexadecimal number. \*/  
**$Number**; /\* The number you want to convert to hexadecimal.e.g. 1234 \*/   
**$NoLeadingZeros**) /\* Optional; Optional, whether to avoid leading zeros. Default is 0.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Number | The number you want to convert to hexadecimal. | 1234 |  |
| NoLeadingZeros | Optional, whether to avoid leading zeros. Default is 0. | 0 | Optional |

### Result

Returns the hexadecimal number.

### Description

Converts a number to a hexadecimal number.  
Works with 32 bit integers.  
### Examples

Query number for 65535. Returns 0000FFFF.

 MBS ( "Math.DecToHex"; 65535 )  
Query number without leading zeros for 4096. Returns 1000.

 MBS ( "Math.DecToHex"; 4096 )  
### See also

- [Hash.CRC16](HashCRC16.md)

### Example Databases

- [Math/Hexadecimal numbers](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Math/Hexadecimal%20numbers.shtml#1GroupButton60.0000000414.000000085.0000000541.0000000LayoutObjectAnchor_)

### Blog Entries

- [MBS FileMaker Plugin 16.0 News](https://www.mbsplugins.de/archive/2026-01-20/MBS_FileMaker_Plugin_160_News/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.5pr3](https://www.mbsplugins.de/archive/2011-12-18/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 18th August 2014

  
[Math.ClearBit](MathClearBit.md) - [Math.DecodeNumber](MathDecodeNumber.md)

[HTML Version](MathDecToHex.shtml)