<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/HTTPURLResponse/localizedString(forStatusCode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSHTTPURLResponse(cm)localizedStringForStatusCode:"
  },
  "title" : "localizedString(forStatusCode:)"
}
-->

# localizedString(forStatusCode:)

Returns a localized string corresponding to a specified HTTP status code.

```
class func localizedString(forStatusCode statusCode: Int) -> String
```

## Parameters

`statusCode`

The HTTP status code. See [RFC 2616](http://www.ietf.org/rfc/rfc2616.txt) for details.

## Return Value

A localized string suitable for displaying to users that describes the specified status code.

## Discussion

---

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)