---
title: "removebom Formula Function: Remove a Byte Order Mark in Nodinite Search Fields"
description: "The removebom Formula function removes a leading byte order mark (BOM) from the message body, a context property, or another function's result, so values and nested functions start with the real content."
---

# <i class="fal fa-function" aria-hidden="true"></i> Formula - removebom

The `removebom` [Formula][] function returns the content without a leading byte order mark (BOM).

![Compare the length of decoded base64 text with and without removebom in the Test Expression tab, animated walkthrough (7.12)][hero]  
*Animated walkthrough: on the base64 body from [Example 1](#example-1-remove-the-bom-from-decoded-base64-content), `length(base64decode(body))` returns `12`, the 11 characters of `test åäöÅÄÖ` plus the invisible BOM, and `length(removebom(base64decode(body)))` returns `11`.*  

## <i class="fal fa-code" aria-hidden="true"></i> Syntax

```text
removebom(content)
```

### Parameters

|Parameter|Required|Description|
|---|---|---|
|`content`|Yes|The text to clean: [body][], [context][], or the result of another function.|

### Returns

The content with a leading BOM removed from each value. [Content][] without a BOM is returned unchanged.

## <i class="fal fa-list-ol" aria-hidden="true"></i> Examples

A UTF-8 BOM is the bytes `EF BB BF` at the start of a file or message (see [With BOM vs without BOM][]). It's invisible in most editors, but it is still a character, and it can sit at the start of base64 text that you decode with [base64decode][].

### Example 1: Remove the BOM from decoded base64 content

#### Input

The [Log API][] takes the message body base64-encoded. To log a body that is itself the base64 text `77u/dGVzdCDDpcOkw7bDhcOEw5Y=`, you send it encoded once more:

```text
Nzd1L2RHVnpkQ0REcGNPa3c3YkRoY09FdzVZPQ==
```

The logged body, shown on the **Message Body** tab and read as UTF-8, is:

```text
77u/dGVzdCDDpcOkw7bDhcOEw5Y=
```

`base64decode(body)` turns this into the bytes `EF BB BF` (a UTF-8 BOM) followed by `test åäöÅÄÖ`. The BOM stays in the result as an invisible first character.

#### Formula and Result

Compare the length of the decoded text with and without `removebom`, using [length][]:

| Formula | Result | Screenshot |
| --- | --- | --- |
| `length(base64decode(body))` | `12` | ![Test Expression tab: length(base64decode(body)) returns 12 for the decoded text with a BOM (7.12)][ex1a] |
| `length(removebom(base64decode(body)))` | `11` | ![Test Expression tab: length(removebom(base64decode(body))) returns 11 once the BOM is removed (7.12)][ex1b] |

*`test åäöÅÄÖ` is 11 characters; the extra character in the first result is the BOM, which `removebom` strips.*  

The same applies to any content that holds base64 text starting with a BOM, for example a JSON property value read with [jsonPath][]: `removebom(base64decode(jsonPath('Payload', body)))`.

## <i class="fal fa-circle-info" aria-hidden="true"></i> Notes

* Only a BOM at the start of each value is removed. To change characters elsewhere in the text, use [replace][] or [replaceregex][].
* A message body read with a *without BOM* [Character Encoding][], such as **UTF-8 (without BOM)**, already has its BOM removed before the formula runs; `removebom` matters for BOMs inside decoded or embedded content.

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-magnifying-glass-plus" aria-hidden="true"></i> [Add or manage Search Field][]  
* <i class="fal fa-flask" aria-hidden="true"></i> [Test Your Expression][]  
* <i class="fal fa-hard-drive" aria-hidden="true"></i> [Add or manage Log View][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-link" aria-hidden="true"></i> [concat][]  
* <i class="fal fa-right-left" aria-hidden="true"></i> [replace][]  
* <i class="fal fa-code" aria-hidden="true"></i> [replaceregex][]  
* <i class="fal fa-scissors" aria-hidden="true"></i> [substring][]  
* <i class="fal fa-function" aria-hidden="true"></i> [Formula][]  
* <i class="fal fa-scroll" aria-hidden="true"></i> [Formula language rules][]  
* <i class="fal fa-puzzle-piece" aria-hidden="true"></i> [Search Field Expressions][]  
* <i class="fal fa-language" aria-hidden="true"></i> [Character Encoding][]  

[Add or manage Log View]:https://docs.nodinite.com/administration/log-management/log-views/features/add-or-manage-log-view/
[Add or manage Search Field]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/
[base64decode]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/convert/base64decode/
[body]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/source/body/
[Character Encoding]:https://docs.nodinite.com/core-services/log-event/features/character-encoding/
[concat]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/alter/concat/
[Content]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/#fa-scroll-formula-language-rules
[Context]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/source/context/
[ex1a]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Alter/removebom_example1_length12.png
[ex1b]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Alter/removebom_example1_length11.png
[Formula]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/
[Formula language rules]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/#fa-scroll-formula-language-rules
[hero]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Alter/Formula_RemoveBom.gif
[jsonPath]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/extract/jsonpath/
[length]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/math/length/
[Log API]:https://docs.nodinite.com/core-services/log-api/overview/
[replace]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/alter/replace/
[replaceregex]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/alter/replaceregex/
[Search Field Expressions]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/
[substring]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/alter/substring/
[Test Your Expression]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/#test-your-expression
[With BOM vs without BOM]:https://docs.nodinite.com/core-services/log-event/features/character-encoding/#fa-code-compare-with-bom-vs-without-bom