<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableData/increaseLength(by:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableData(im)increaseLengthBy:"
  },
  "title" : "increaseLength(by:)"
}
-->

# increaseLength(by:)

Increases the length of the receiver by a given number of bytes.

```
func increaseLength(by extraLength: Int)
```

## Parameters

`extraLength`

The number of bytes by which to increase the receiver’s length.

## Discussion

The additional bytes are all set to `0`.

> Important:
> Changing the length of a mutable data object invalidates any existing data pointers returned by the ``doc://com.apple.foundation/documentation/Foundation/NSData/bytes`` or ``doc://com.apple.foundation/documentation/Foundation/NSMutableData/mutableBytes`` properties.

## See Also

[`length`](/documentation/Foundation/NSMutableData/length)

The number of bytes contained in the mutable data object.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)